注册流程
This commit is contained in:
40
components/result/README.md
Normal file
40
components/result/README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: Result 结果
|
||||
description: 反馈结果状态。
|
||||
spline: data
|
||||
isComponent: true
|
||||
---
|
||||
|
||||
<span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20lines-93%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20functions-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20statements-93%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20branches-25%25-red" /></span>
|
||||
## 引入
|
||||
|
||||
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
|
||||
|
||||
```json
|
||||
"usingComponents": {
|
||||
"t-result": "/components/result/result"
|
||||
}
|
||||
```
|
||||
|
||||
## 代码演示
|
||||
|
||||
### 结果状态
|
||||
|
||||
{{ theme }}
|
||||
|
||||
### 自定义结果
|
||||
|
||||
{{ custom }}
|
||||
|
||||
## API
|
||||
|
||||
### Result Props
|
||||
|
||||
| 名称 | 类型 | 默认值 | 说明 | 必传 |
|
||||
| ---------------- | ------------- | ------ | ------ | ---- |
|
||||
| title | String / Slot | - | 标题 | N |
|
||||
| description | String / Slot | - | 描述文字 | N |
|
||||
| external-classes | Array | - | 组件类名,分别用于设置 组件外层类名、文本描述类名、图片类名、操作按钮类名。`['t-class', 't-class-image', 't-class-title', 't-class-description']` | N |
|
||||
| icon | String | - | 图标名称 | N |
|
||||
| image | String / Slot | - | 图片地址 | N |
|
||||
| theme | String | default| 内置主题。可选项:default/success/warning/error | N |
|
||||
3
components/result/index.d.ts
vendored
Normal file
3
components/result/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './type';
|
||||
export * from './props';
|
||||
export * from './result';
|
||||
3
components/result/index.js
Normal file
3
components/result/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './type';
|
||||
export * from './props';
|
||||
export * from './result';
|
||||
3
components/result/props.d.ts
vendored
Normal file
3
components/result/props.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { TdResultProps } from './type';
|
||||
declare const props: TdResultProps;
|
||||
export default props;
|
||||
24
components/result/props.js
Normal file
24
components/result/props.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const props = {
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
externalClasses: {
|
||||
type: Array,
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
image: {
|
||||
type: String,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
value: 'default',
|
||||
},
|
||||
};
|
||||
export default props;
|
||||
18
components/result/result.d.ts
vendored
Normal file
18
components/result/result.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { SuperComponent } from '../common/src/index';
|
||||
export default class extends SuperComponent {
|
||||
options: {
|
||||
multipleSlots: boolean;
|
||||
};
|
||||
externalClasses: string[];
|
||||
properties: import("./type").TdResultProps;
|
||||
data: {
|
||||
prefix: string;
|
||||
classPrefix: string;
|
||||
};
|
||||
lifetimes: {
|
||||
ready(): void;
|
||||
};
|
||||
methods: {
|
||||
setIcon(): void;
|
||||
};
|
||||
}
|
||||
58
components/result/result.js
Normal file
58
components/result/result.js
Normal file
@@ -0,0 +1,58 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
import { SuperComponent, wxComponent } from '../common/src/index';
|
||||
import props from './props';
|
||||
import config from '../common/config';
|
||||
const { prefix } = config;
|
||||
const name = `${prefix}-result`;
|
||||
let default_1 = class extends SuperComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.options = {
|
||||
multipleSlots: true,
|
||||
};
|
||||
this.externalClasses = [
|
||||
`${prefix}-class`,
|
||||
`${prefix}-class-image`,
|
||||
`${prefix}-class-title`,
|
||||
`${prefix}-class-description`,
|
||||
];
|
||||
this.properties = props;
|
||||
this.data = {
|
||||
prefix,
|
||||
classPrefix: name,
|
||||
};
|
||||
this.lifetimes = {
|
||||
ready() {
|
||||
this.setIcon();
|
||||
},
|
||||
};
|
||||
this.methods = {
|
||||
setIcon() {
|
||||
const { icon, theme } = this.properties;
|
||||
if (icon) {
|
||||
this.setData({
|
||||
iconName: icon !== 'null' ? `${icon}` : '',
|
||||
});
|
||||
}
|
||||
else {
|
||||
const themeResult = {
|
||||
default: 'error-circle',
|
||||
success: 'check-circle',
|
||||
warning: 'error-circle',
|
||||
error: 'close-circle',
|
||||
};
|
||||
this.setData({ iconName: themeResult[theme] });
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
default_1 = __decorate([
|
||||
wxComponent()
|
||||
], default_1);
|
||||
export default default_1;
|
||||
7
components/result/result.json
Normal file
7
components/result/result.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-icon": "../icon/icon",
|
||||
"t-image": "../image/image"
|
||||
}
|
||||
}
|
||||
16
components/result/result.wxml
Normal file
16
components/result/result.wxml
Normal file
@@ -0,0 +1,16 @@
|
||||
<view class="{{classPrefix}} {{classPrefix}}--theme-{{theme}} {{prefix}}-class">
|
||||
<view class="{{classPrefix}}__thumb">
|
||||
<t-image wx:if="{{image}}" t-class="{{prefix}}-class-image" src="{{image}}" mode="aspectFit" />
|
||||
<t-icon wx:elif="{{ iconName }}" size="160rpx" name="{{ iconName }}" />
|
||||
<slot wx:else name="image" class="{{prefix}}-class-image" />
|
||||
</view>
|
||||
|
||||
<view class="{{classPrefix}}__title {{prefix}}-class-title">
|
||||
<view wx:if="{{title}}"> {{title}} </view>
|
||||
<slot wx:else name="title" />
|
||||
</view>
|
||||
<view class="{{classPrefix}}__description {{prefix}}-class-description">
|
||||
<view wx:if="{{description}}"> {{description}} </view>
|
||||
<slot wx:else name="description" />
|
||||
</view>
|
||||
</view>
|
||||
65
components/result/result.wxss
Normal file
65
components/result/result.wxss
Normal file
@@ -0,0 +1,65 @@
|
||||
.t-float-left {
|
||||
float: left;
|
||||
}
|
||||
.t-float-right {
|
||||
float: right;
|
||||
}
|
||||
@keyframes tdesign-fade-out {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.hotspot-expanded.relative {
|
||||
position: relative;
|
||||
}
|
||||
.hotspot-expanded::after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
transform: scale(1.5);
|
||||
}
|
||||
.t-result {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.t-result__title {
|
||||
line-height: 56rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
}
|
||||
.t-result__icon {
|
||||
font-size: 80px;
|
||||
}
|
||||
.t-result__thumb + .t-result__title:not(:empty) {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
.t-result__description {
|
||||
text-align: center;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
font-size: 28rpx;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
.t-result__title + .t-result__description:not(:empty) {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.t-result--theme-default {
|
||||
color: #0052d9;
|
||||
}
|
||||
.t-result--theme-success {
|
||||
color: #00a870;
|
||||
}
|
||||
.t-result--theme-warning {
|
||||
color: #ed7b2f;
|
||||
}
|
||||
.t-result--theme-error {
|
||||
color: #e34d59;
|
||||
}
|
||||
30
components/result/type.d.ts
vendored
Normal file
30
components/result/type.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
export interface TdResultProps {
|
||||
description?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
required?: boolean;
|
||||
};
|
||||
externalClasses?: {
|
||||
type: ArrayConstructor;
|
||||
value?: ['t-class', 't-class-description', 't-class-image'];
|
||||
required?: boolean;
|
||||
};
|
||||
icon?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
required?: boolean;
|
||||
};
|
||||
image?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
required?: boolean;
|
||||
};
|
||||
title?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
theme?: {
|
||||
type: StringConstructor;
|
||||
value?: 'default' | 'success' | 'warning' | 'error';
|
||||
};
|
||||
}
|
||||
1
components/result/type.js
Normal file
1
components/result/type.js
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in New Issue
Block a user