start
This commit is contained in:
41
miniprogram_npm/tdesign-miniprogram/result/README.en-US.md
Normal file
41
miniprogram_npm/tdesign-miniprogram/result/README.en-US.md
Normal file
@@ -0,0 +1,41 @@
|
||||
:: BASE_DOC ::
|
||||
|
||||
## API
|
||||
|
||||
### Result Props
|
||||
|
||||
name | type | default | description | required
|
||||
-- | -- | -- | -- | --
|
||||
style | Object | - | CSS(Cascading Style Sheets) | N
|
||||
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
|
||||
description | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
icon | String / Boolean / Object | true | \- | N
|
||||
image | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
theme | String | default | options: default/success/warning/error | N
|
||||
title | String / Slot | '' | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
### Result External Classes
|
||||
|
||||
className | Description
|
||||
-- | --
|
||||
t-class | \-
|
||||
t-class-description | \-
|
||||
t-class-image | \-
|
||||
t-class-title | \-
|
||||
|
||||
### CSS Variables
|
||||
|
||||
The component provides the following CSS variables, which can be used to customize styles.
|
||||
Name | Default Value | Description
|
||||
-- | -- | --
|
||||
--td-result-description-color | @font-gray-2 | -
|
||||
--td-result-description-font-size | @font-size-base | -
|
||||
--td-result-description-line-height | 44rpx | -
|
||||
--td-result-description-margin-top | @spacer | -
|
||||
--td-result-icon-default-color | @brand-color | -
|
||||
--td-result-icon-error-color | @error-color | -
|
||||
--td-result-icon-success-color | @success-color | -
|
||||
--td-result-icon-warning-color | @warning-color | -
|
||||
--td-result-title-color | @font-gray-1 | -
|
||||
--td-result-title-font-size | @font-size-l | -
|
||||
--td-result-title-line-height | 56rpx | -
|
||||
--td-result-title-margin-top | @spacer-1 | -
|
||||
99
miniprogram_npm/tdesign-miniprogram/result/README.md
Normal file
99
miniprogram_npm/tdesign-miniprogram/result/README.md
Normal file
@@ -0,0 +1,99 @@
|
||||
---
|
||||
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>
|
||||
|
||||
<div style="background: #ecf2fe; display: flex; align-items: center; line-height: 20px; padding: 14px 24px; border-radius: 3px; color: #555a65">
|
||||
<svg fill="none" viewBox="0 0 16 16" width="16px" height="16px" style="margin-right: 5px">
|
||||
<path fill="#0052d9" d="M8 15A7 7 0 108 1a7 7 0 000 14zM7.4 4h1.2v1.2H7.4V4zm.1 2.5h1V12h-1V6.5z" fillOpacity="0.9"></path>
|
||||
</svg>
|
||||
该组件于 0.16.0 版本上线,请留意版本。
|
||||
</div>
|
||||
|
||||
## 引入
|
||||
|
||||
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
|
||||
|
||||
```json
|
||||
"usingComponents": {
|
||||
"t-result": "tdesign-miniprogram/result/result"
|
||||
}
|
||||
```
|
||||
|
||||
## 代码演示
|
||||
|
||||
<a href="https://developers.weixin.qq.com/s/lw77kim37uSg" title="在开发者工具中预览效果" target="_blank" rel="noopener noreferrer"> 在开发者工具中预览效果 </a>
|
||||
|
||||
<blockquote style="background-color: #d9e1ff; font-size: 15px; line-height: 26px;margin: 16px 0 0;padding: 16px; border-radius: 6px; color: #0052d9" >
|
||||
<p>Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"</p>
|
||||
</blockquote>
|
||||
|
||||
### 组件类型
|
||||
|
||||
基础结果
|
||||
|
||||
{{ theme }}
|
||||
|
||||
带描述的结果
|
||||
|
||||
{{ description }}
|
||||
|
||||
自定义结果
|
||||
|
||||
{{ custom }}
|
||||
|
||||
## 常见问题
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
本地图片无法正确引用?
|
||||
<span class="icon">👇</span>
|
||||
</summary>
|
||||
<p style="margin-top: 10px; color: rgba(0, 0, 0, .6)">
|
||||
建议使用绝对路径,而不是相对路径。绝对路径以 app.json 所在位置为基准。
|
||||
</p>
|
||||
</details>
|
||||
|
||||
## API
|
||||
|
||||
### Result Props
|
||||
|
||||
名称 | 类型 | 默认值 | 描述 | 必传
|
||||
-- | -- | -- | -- | --
|
||||
style | Object | - | 样式 | N
|
||||
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
|
||||
description | String / Slot | - | 描述文字。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
icon | String / Boolean / Object | true | 图标名称。值为字符串表示图标名称,值为 `false` 表示不显示图标,值为 `Object` 类型,表示透传至 `icon`,不传表示使用主题图标。 | N
|
||||
image | String / Slot | - | 图片地址。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
theme | String | default | 内置主题。可选项:default/success/warning/error | N
|
||||
title | String / Slot | '' | 标题。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
|
||||
### Result External Classes
|
||||
|
||||
类名 | 描述
|
||||
-- | --
|
||||
t-class | 根节点样式类
|
||||
t-class-description | 描述样式类
|
||||
t-class-image | 图片样式类
|
||||
t-class-title | 标题样式类
|
||||
|
||||
### CSS Variables
|
||||
|
||||
组件提供了下列 CSS 变量,可用于自定义样式。
|
||||
名称 | 默认值 | 描述
|
||||
-- | -- | --
|
||||
--td-result-description-color | @font-gray-2 | -
|
||||
--td-result-description-font-size | @font-size-base | -
|
||||
--td-result-description-line-height | 44rpx | -
|
||||
--td-result-description-margin-top | @spacer | -
|
||||
--td-result-icon-default-color | @brand-color | -
|
||||
--td-result-icon-error-color | @error-color | -
|
||||
--td-result-icon-success-color | @success-color | -
|
||||
--td-result-icon-warning-color | @warning-color | -
|
||||
--td-result-title-color | @font-gray-1 | -
|
||||
--td-result-title-font-size | @font-size-l | -
|
||||
--td-result-title-line-height | 56rpx | -
|
||||
--td-result-title-margin-top | @spacer-1 | -
|
||||
3
miniprogram_npm/tdesign-miniprogram/result/index.d.ts
vendored
Normal file
3
miniprogram_npm/tdesign-miniprogram/result/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './type';
|
||||
export * from './props';
|
||||
export * from './result';
|
||||
3
miniprogram_npm/tdesign-miniprogram/result/index.js
Normal file
3
miniprogram_npm/tdesign-miniprogram/result/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './type';
|
||||
export * from './props';
|
||||
export * from './result';
|
||||
3
miniprogram_npm/tdesign-miniprogram/result/props.d.ts
vendored
Normal file
3
miniprogram_npm/tdesign-miniprogram/result/props.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { TdResultProps } from './type';
|
||||
declare const props: TdResultProps;
|
||||
export default props;
|
||||
21
miniprogram_npm/tdesign-miniprogram/result/props.js
Normal file
21
miniprogram_npm/tdesign-miniprogram/result/props.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const props = {
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
icon: {
|
||||
type: null,
|
||||
value: true,
|
||||
},
|
||||
image: {
|
||||
type: String,
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
value: 'default',
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
};
|
||||
export default props;
|
||||
21
miniprogram_npm/tdesign-miniprogram/result/result.d.ts
vendored
Normal file
21
miniprogram_npm/tdesign-miniprogram/result/result.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
};
|
||||
observers: {
|
||||
'icon, theme'(): void;
|
||||
};
|
||||
methods: {
|
||||
initIcon(): void;
|
||||
};
|
||||
}
|
||||
59
miniprogram_npm/tdesign-miniprogram/result/result.js
Normal file
59
miniprogram_npm/tdesign-miniprogram/result/result.js
Normal file
@@ -0,0 +1,59 @@
|
||||
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';
|
||||
import { calcIcon } from '../common/utils';
|
||||
const { prefix } = config;
|
||||
const name = `${prefix}-result`;
|
||||
const THEME_ICON = {
|
||||
default: 'error-circle',
|
||||
success: 'check-circle',
|
||||
warning: 'error-circle',
|
||||
error: 'close-circle',
|
||||
};
|
||||
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.initIcon();
|
||||
},
|
||||
};
|
||||
this.observers = {
|
||||
'icon, theme'() {
|
||||
this.initIcon();
|
||||
},
|
||||
};
|
||||
this.methods = {
|
||||
initIcon() {
|
||||
const { icon, theme } = this.properties;
|
||||
this.setData({
|
||||
_icon: calcIcon(icon, THEME_ICON[theme]),
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
default_1 = __decorate([
|
||||
wxComponent()
|
||||
], default_1);
|
||||
export default default_1;
|
||||
8
miniprogram_npm/tdesign-miniprogram/result/result.json
Normal file
8
miniprogram_npm/tdesign-miniprogram/result/result.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"t-icon": "../icon/icon",
|
||||
"t-image": "../image/image"
|
||||
}
|
||||
}
|
||||
22
miniprogram_npm/tdesign-miniprogram/result/result.wxml
Normal file
22
miniprogram_npm/tdesign-miniprogram/result/result.wxml
Normal file
@@ -0,0 +1,22 @@
|
||||
<import src="../common/template/icon.wxml" />
|
||||
<wxs src="../common/utils.wxs" module="_" />
|
||||
|
||||
<view
|
||||
style="{{_._style([style, customStyle])}}"
|
||||
class="{{classPrefix}} {{classPrefix}}--theme-{{theme}} class {{prefix}}-class"
|
||||
>
|
||||
<view aria-hidden="true" class="{{classPrefix}}__thumb">
|
||||
<t-image wx:if="{{image}}" t-class="{{prefix}}-class-image" src="{{image}}" mode="aspectFit" />
|
||||
<template wx:elif="{{_icon}}" is="icon" data="{{tClass: classPrefix + '__icon', ..._icon }}" />
|
||||
<slot name="image" />
|
||||
</view>
|
||||
|
||||
<view class="{{classPrefix}}__title {{prefix}}-class-title">
|
||||
<block wx:if="{{title}}"> {{title}} </block>
|
||||
<slot name="title" />
|
||||
</view>
|
||||
<view class="{{classPrefix}}__description {{prefix}}-class-description">
|
||||
<block wx:if="{{description}}"> {{description}} </block>
|
||||
<slot name="description" />
|
||||
</view>
|
||||
</view>
|
||||
65
miniprogram_npm/tdesign-miniprogram/result/result.wxss
Normal file
65
miniprogram_npm/tdesign-miniprogram/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__icon {
|
||||
font-size: 160rpx;
|
||||
}
|
||||
.t-result__title {
|
||||
line-height: var(--td-result-title-line-height, 56rpx);
|
||||
font-size: var(--td-result-title-font-size, var(--td-font-size-xl, 40rpx));
|
||||
font-weight: 700;
|
||||
color: var(--td-result-title-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
|
||||
}
|
||||
.t-result__thumb:not(:empty) + .t-result__title:not(:empty) {
|
||||
margin-top: var(--td-result-title-margin-top, var(--td-spacer-1, 24rpx));
|
||||
}
|
||||
.t-result__description {
|
||||
text-align: center;
|
||||
color: var(--td-result-description-color, var(--td-text-color-secondary, var(--td-font-gray-2, rgba(0, 0, 0, 0.6))));
|
||||
font-size: var(--td-result-description-font-size, var(--td-font-size-base, 28rpx));
|
||||
line-height: var(--td-result-description-line-height, 44rpx);
|
||||
}
|
||||
.t-result__title + .t-result__description:not(:empty) {
|
||||
margin-top: var(--td-result-description-margin-top, var(--td-spacer, 16rpx));
|
||||
}
|
||||
.t-result--theme-default {
|
||||
color: var(--td-result-icon-default-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
|
||||
}
|
||||
.t-result--theme-success {
|
||||
color: var(--td-result-icon-success-color, var(--td-success-color, var(--td-success-color-5, #2ba471)));
|
||||
}
|
||||
.t-result--theme-warning {
|
||||
color: var(--td-result-icon-warning-color, var(--td-warning-color, var(--td-warning-color-5, #e37318)));
|
||||
}
|
||||
.t-result--theme-error {
|
||||
color: var(--td-result-icon-error-color, var(--td-error-color, var(--td-error-color-6, #d54941)));
|
||||
}
|
||||
22
miniprogram_npm/tdesign-miniprogram/result/type.d.ts
vendored
Normal file
22
miniprogram_npm/tdesign-miniprogram/result/type.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export interface TdResultProps {
|
||||
description?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
icon?: {
|
||||
type: null;
|
||||
value?: string | boolean | object;
|
||||
};
|
||||
image?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
theme?: {
|
||||
type: StringConstructor;
|
||||
value?: 'default' | 'success' | 'warning' | 'error';
|
||||
};
|
||||
title?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
}
|
||||
1
miniprogram_npm/tdesign-miniprogram/result/type.js
Normal file
1
miniprogram_npm/tdesign-miniprogram/result/type.js
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in New Issue
Block a user