任务明细页面
This commit is contained in:
44
components/fab/README.md
Normal file
44
components/fab/README.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: Fab
|
||||
description: 当功能使用图标即可表意清楚时,可使用纯图标悬浮按钮,例如:添加、发布。
|
||||
spline: form
|
||||
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-fab": "tdesign-miniprogram/fab/fab"
|
||||
}
|
||||
```
|
||||
|
||||
## 代码演示
|
||||
|
||||
### 基础使用
|
||||
|
||||
{{ base }}
|
||||
|
||||
### 进阶使用
|
||||
|
||||
{{ advance }}
|
||||
|
||||
## API
|
||||
### Fab Props
|
||||
|
||||
名称 | 类型 | 默认值 | 说明 | 必传
|
||||
-- | -- | -- | -- | --
|
||||
button-props | Object | - | 透传至 Button 组件 | N
|
||||
icon | String | - | 图标 | N
|
||||
style | String | right: 16px; bottom: 32px; | 悬浮按钮的样式,常用于调整位置 | N
|
||||
text | String | - | 文本内容 | N
|
||||
|
||||
### Fab Events
|
||||
|
||||
名称 | 参数 | 描述
|
||||
-- | -- | --
|
||||
click | `({e: Event})` | 悬浮按钮点击事件
|
||||
20
components/fab/fab.d.ts
vendored
Normal file
20
components/fab/fab.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { SuperComponent } from '../common/src/index';
|
||||
export default class Fab extends SuperComponent {
|
||||
properties: import("./type").TdFabProps;
|
||||
externalClasses: string[];
|
||||
data: {
|
||||
prefix: string;
|
||||
classPrefix: string;
|
||||
baseButtonProps: {
|
||||
size: string;
|
||||
shape: string;
|
||||
theme: string;
|
||||
};
|
||||
};
|
||||
observers: {
|
||||
text(val: any): void;
|
||||
};
|
||||
methods: {
|
||||
onTplButtonTap(e: any): void;
|
||||
};
|
||||
}
|
||||
47
components/fab/fab.js
Normal file
47
components/fab/fab.js
Normal file
@@ -0,0 +1,47 @@
|
||||
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 config from '../common/config';
|
||||
import props from './props';
|
||||
const { prefix } = config;
|
||||
const name = `${prefix}-fab`;
|
||||
let Fab = class Fab extends SuperComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.properties = props;
|
||||
this.externalClasses = [`${prefix}-class`, `${prefix}-class-button`];
|
||||
this.data = {
|
||||
prefix,
|
||||
classPrefix: name,
|
||||
baseButtonProps: {
|
||||
size: 'large',
|
||||
shape: 'circle',
|
||||
theme: 'primary',
|
||||
},
|
||||
};
|
||||
this.observers = {
|
||||
text(val) {
|
||||
if (val) {
|
||||
this.setData({
|
||||
baseButtonProps: {
|
||||
shape: 'round',
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
this.methods = {
|
||||
onTplButtonTap(e) {
|
||||
this.triggerEvent('click', e);
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
Fab = __decorate([
|
||||
wxComponent()
|
||||
], Fab);
|
||||
export default Fab;
|
||||
6
components/fab/fab.json
Normal file
6
components/fab/fab.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-button": "../button/button"
|
||||
}
|
||||
}
|
||||
8
components/fab/fab.wxml
Normal file
8
components/fab/fab.wxml
Normal file
@@ -0,0 +1,8 @@
|
||||
<import src="../common/template/button.wxml" />
|
||||
|
||||
<view class="{{classPrefix}} {{prefix}}-class" style="{{style}}">
|
||||
<template
|
||||
is="button"
|
||||
data="{{ ...baseButtonProps, icon, ...buttonProps, externalClass: prefix + '-class-button', content: text}}"
|
||||
/>
|
||||
</view>
|
||||
52
components/fab/fab.wxss
Normal file
52
components/fab/fab.wxss
Normal file
@@ -0,0 +1,52 @@
|
||||
.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-fab {
|
||||
position: fixed;
|
||||
width: auto;
|
||||
min-width: 86rpx;
|
||||
height: 86rpx;
|
||||
line-height: normal;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 48rpx;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
.t-fab .t-button__text {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.t-fab::after {
|
||||
border-radius: inherit;
|
||||
}
|
||||
.t-fab__text {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
.t-fab--icononly {
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
}
|
||||
3
components/fab/props.d.ts
vendored
Normal file
3
components/fab/props.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { TdFabProps } from './type';
|
||||
declare const props: TdFabProps;
|
||||
export default props;
|
||||
18
components/fab/props.js
Normal file
18
components/fab/props.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const props = {
|
||||
buttonProps: {
|
||||
type: Object,
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
style: {
|
||||
type: String,
|
||||
value: 'right: 16px; bottom: 32px;',
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
};
|
||||
export default props;
|
||||
18
components/fab/type.d.ts
vendored
Normal file
18
components/fab/type.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
export interface TdFabProps {
|
||||
buttonProps?: {
|
||||
type: ObjectConstructor;
|
||||
value?: object;
|
||||
};
|
||||
icon?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
style?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
text?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
}
|
||||
1
components/fab/type.js
Normal file
1
components/fab/type.js
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in New Issue
Block a user