白色主题

This commit is contained in:
2023-02-12 19:04:01 +08:00
parent d736a5912f
commit 57ab6fbb49
411 changed files with 1752 additions and 5304 deletions

View File

@@ -6,6 +6,7 @@ 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`中配置。
@@ -16,6 +17,18 @@ isComponent: true
}
```
## 常见问题
<details>
<summary>
控制台告警Faild to load font
<span class="icon">👇</span>
</summary>
<p style="margin-top: 10px; color: rgba(0, 0, 0, .6)">
告警属于开发者工具的 bug可以忽略具体可以看 <a href="https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html" target="_blank">官网文档</a>
</p>
</details>
## 代码演示
### 基础组件图标

View File

@@ -1,6 +1,5 @@
import { SuperComponent } from '../common/src/index';
export default class Icon extends SuperComponent {
behaviors: ['wx://form-field-icon'];
externalClasses: string[];
properties: import("./type").TdIconProps;
data: {
@@ -10,7 +9,7 @@ export default class Icon extends SuperComponent {
iconStyle: any;
};
observers: {
'name, color, size, customStyle'(): void;
'name, color, size, style'(): void;
};
methods: {
onTap(event: any): void;

View File

@@ -13,7 +13,7 @@ const name = `${prefix}-icon`;
let Icon = class Icon extends SuperComponent {
constructor() {
super(...arguments);
this.externalClasses = [`${prefix}-class`];
this.externalClasses = ['class', `${prefix}-class`];
this.properties = props;
this.data = {
componentPrefix: prefix,
@@ -22,7 +22,7 @@ let Icon = class Icon extends SuperComponent {
iconStyle: undefined,
};
this.observers = {
'name, color, size, customStyle'() {
'name, color, size, style'() {
this.setIconStyle();
},
};
@@ -31,7 +31,7 @@ let Icon = class Icon extends SuperComponent {
this.triggerEvent('click', event.detail);
},
setIconStyle() {
const { name, color, size, customStyle } = this.properties;
const { name, color, size, style } = this.properties;
const isImage = name.indexOf('/') !== -1;
const sizeValue = addUnit(size);
const sizeStyle = isImage ? { width: sizeValue, height: sizeValue } : {};
@@ -39,7 +39,7 @@ let Icon = class Icon extends SuperComponent {
const fontStyle = size ? { 'font-size': sizeValue } : {};
this.setData({
isImage,
iconStyle: `${styles(Object.assign(Object.assign(Object.assign({}, colorStyle), fontStyle), sizeStyle))}${customStyle ? `;${customStyle}` : ''}`,
iconStyle: `${styles(Object.assign(Object.assign(Object.assign({}, colorStyle), fontStyle), sizeStyle))}${style ? `;${style}` : ''}`,
});
},
};

View File

@@ -1,5 +1,5 @@
<view
class="{{ prefix ? prefix : classPrefix}} {{componentPrefix}}-class"
class="{{ prefix ? prefix : classPrefix}} class {{componentPrefix}}-class"
style="{{ iconStyle }}"
bind:tap="onTap"
aria-hidden="{{ariaHidden}}"

View File

@@ -47,7 +47,7 @@
font-variant: normal;
text-transform: none;
line-height: 1;
/*text-align: center;*/
text-align: center;
display: block;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;

View File

@@ -1,5 +1,5 @@
const props = {
customStyle: {
style: {
type: String,
value: '',
},

View File

@@ -1,5 +1,5 @@
export interface TdIconProps {
customStyle?: {
style?: {
type: StringConstructor;
value?: string;
required?: boolean;