bug fix and performance improvements
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
:: BASE_DOC ::
|
||||
|
||||
## API
|
||||
### Fab Props
|
||||
|
||||
name | type | default | description | required
|
||||
-- | -- | -- | -- | --
|
||||
button-props | Object | - | \- | N
|
||||
icon | String | - | \- | N
|
||||
style | String | right: 16px; bottom: 32px; | \- | N
|
||||
text | String | - | \- | N
|
||||
|
||||
### Fab Events
|
||||
|
||||
name | params | description
|
||||
-- | -- | --
|
||||
click | `(detail: {e: MouseEvent})` | \-
|
||||
|
||||
|
||||
### CSS Variables
|
||||
The component provides the following CSS variables, which can be used to customize styles.
|
||||
Name | Default Value | Description
|
||||
-- | -- | --
|
||||
--td-fab-shadow | @shadow-2 | -
|
||||
@ -0,0 +1,59 @@
|
||||
---
|
||||
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>
|
||||
|
||||
<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.7.2 版本上线,请留意版本。
|
||||
</div>
|
||||
|
||||
## 引入
|
||||
|
||||
全局引入,在 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; | 悬浮按钮的样式,常用于调整位置(即将废弃,建议使用 `style`) | N
|
||||
text | String | - | 文本内容 | N
|
||||
|
||||
### Fab Events
|
||||
|
||||
名称 | 参数 | 描述
|
||||
-- | -- | --
|
||||
click | `({e: Event})` | 悬浮按钮点击事件
|
||||
|
||||
|
||||
### CSS 变量
|
||||
组件提供了下列 CSS 变量,可用于自定义样式。
|
||||
名称 | 默认值 | 描述
|
||||
-- | -- | --
|
||||
--td-fab-shadow | @shadow-2 | -
|
||||
20
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/fab.d.ts
vendored
Normal file
20
miniprogram/miniprogram_npm/tdesign-miniprogram/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
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/fab.js
Normal file
47
miniprogram/miniprogram_npm/tdesign-miniprogram/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 = [`class`, `${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;
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-button": "../button/button"
|
||||
}
|
||||
}
|
||||
12
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/fab.wxml
Normal file
12
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/fab.wxml
Normal file
@ -0,0 +1,12 @@
|
||||
<import src="../common/template/button.wxml" />
|
||||
<wxs src="../common/utils.wxs" module="_" />
|
||||
|
||||
<view
|
||||
class="{{classPrefix}} class {{prefix}}-class"
|
||||
style="right: 16px; bottom: 32px; {{_._style([style, customStyle])}}"
|
||||
>
|
||||
<template
|
||||
is="button"
|
||||
data="{{ ...baseButtonProps, icon, ...buttonProps, externalClass: prefix + '-fab__button', content: text, ariaLabel}}"
|
||||
/>
|
||||
</view>
|
||||
33
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/fab.wxss
Normal file
33
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/fab.wxss
Normal file
@ -0,0 +1,33 @@
|
||||
.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;
|
||||
}
|
||||
.t-fab__button {
|
||||
box-shadow: var(--td-fab-shadow, var(--td-shadow-2, 0 3px 14px 2px rgba(0, 0, 0, 0.05), 0 8px 10px 1px rgba(0, 0, 0, 0.06), 0 5px 5px -3px rgba(0, 0, 0, 0.1)));
|
||||
}
|
||||
3
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/props.d.ts
vendored
Normal file
3
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/props.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import { TdFabProps } from './type';
|
||||
declare const props: TdFabProps;
|
||||
export default props;
|
||||
14
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/props.js
Normal file
14
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/props.js
Normal file
@ -0,0 +1,14 @@
|
||||
const props = {
|
||||
buttonProps: {
|
||||
type: Object,
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
};
|
||||
export default props;
|
||||
18
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/type.d.ts
vendored
Normal file
18
miniprogram/miniprogram_npm/tdesign-miniprogram/fab/type.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
export interface TdFabProps {
|
||||
buttonProps?: {
|
||||
type: ObjectConstructor;
|
||||
value?: object;
|
||||
};
|
||||
style?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
icon?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
text?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in New Issue
Block a user