纪念日调整

This commit is contained in:
limqhz
2022-12-01 17:21:12 +08:00
parent 526a7505a7
commit abdcb5661e
37 changed files with 705 additions and 6 deletions

View File

@@ -0,0 +1,47 @@
---
title: Empty 空内容
description: 用于空状态时的占位提示。
spline: data
isComponent: true
---
<span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20lines-100%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-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20branches-100%25-blue" /></span>
## 引入
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
```json
"usingComponents": {
"t-empty": "tdesign-miniprogram/empty/empty"
}
```
## 代码演示
### 图标空状态
{{ base }}
### 自定义图片空状态
{{ imageEmpty }}
### 带操作空状态
{{ buttonEmpty }}
### 空页面
{{ pageEmpty }}
## API
### Empty Props
| 名称 | 类型 | 默认值 | 说明 | 必传 |
| ---------------- | ------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---- |
| action | Slot | - | 操作按钮 | N |
| description | String / Slot | - | 描述文字 | N |
| external-classes | Array | - | 组件类名,分别用于设置 组件外层类名、文本描述类名、图片类名、操作按钮类名。`['t-class', 't-class-description', 't-class-image', 't-class-actions']` | N |
| icon | String | - | 图标名称 | N |
| image | String / Slot | - | 图片地址 | N |

11
components/empty/empty.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
import { SuperComponent } from '../common/src/index';
export default class extends SuperComponent {
options: {
multipleSlots: boolean;
};
externalClasses: string[];
properties: import("./type").TdEmptyProps;
data: {
classPrefix: string;
};
}

28
components/empty/empty.js Normal file
View File

@@ -0,0 +1,28 @@
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}-empty`;
let default_1 = class extends SuperComponent {
constructor() {
super(...arguments);
this.options = {
multipleSlots: true,
};
this.externalClasses = ['t-class', 't-class-description', 't-class-image'];
this.properties = props;
this.data = {
classPrefix: name,
};
}
};
default_1 = __decorate([
wxComponent()
], default_1);
export default default_1;

View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"t-icon": "../icon/icon"
}
}

View File

@@ -0,0 +1,21 @@
<wxs src="./empty.wxs" module="utils" />
<view class="t-class {{classPrefix}}">
<view class="{{classPrefix}}__content">
<image
wx:if="{{image}}"
class="{{classPrefix}}__img t-class-image"
src="{{image}}"
mode="aspectFit"
/>
<t-icon wx:elif="{{icon}}" size="192rpx" name="{{icon}}" color="rgba(0, 0, 0, .26)" />
<slot wx:else name="image" class="{{classPrefix}}__img t-class-image" />
<view wx:if="{{description}}" class="{{classPrefix}}__description t-class-description"
>{{description}}</view
>
<slot wx:else name="description" class="{{classPrefix}}__description t-class-description}" />
<view class="{{classPrefix}}__actions t-class-actions">
<slot name="action" />
</view>
</view>
</view>

View File

@@ -0,0 +1,12 @@
var REGEXP = getRegExp('^\d+(\.\d+)?$');
function addUnit(value) {
if (value == null) {
return undefined;
}
return REGEXP.test('' + value) ? value + 'px' : value;
}
module.exports = {
addUnit: addUnit,
};

View File

@@ -0,0 +1,48 @@
.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-empty {
display: flex;
flex-direction: column;
}
.t-empty__content {
text-align: center;
}
.t-empty__img {
width: 100rpx;
height: 100rpx;
}
.t-empty__description {
margin-top: 48rpx;
text-align: center;
color: rgba(0, 0, 0, 0.4);
font-size: 28rpx;
line-height: 44rpx;
}
.t-empty__description + .t-empty__actions:not(:empty) {
margin-top: 48rpx;
}

3
components/empty/props.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { TdEmptyProps } from './type';
declare const props: TdEmptyProps;
export default props;

16
components/empty/props.js Normal file
View File

@@ -0,0 +1,16 @@
const props = {
description: {
type: String,
},
externalClasses: {
type: Array,
},
icon: {
type: String,
value: '',
},
image: {
type: String,
},
};
export default props;

22
components/empty/type.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
export interface TdEmptyProps {
description?: {
type: StringConstructor;
value?: string;
required?: boolean;
};
externalClasses?: {
type: ArrayConstructor;
value?: ['t-class', 't-class-description', 't-class-image', 't-class-actions'];
required?: boolean;
};
icon?: {
type: StringConstructor;
value?: string;
required?: boolean;
};
image?: {
type: StringConstructor;
value?: string;
required?: boolean;
};
}

2
components/empty/type.js Normal file
View File

@@ -0,0 +1,2 @@
;
export {};