@tuya-miniapp/smart-ui 2.13.2-beta-0 → 2.13.2-beta-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-sheet/README.md +631 -0
- package/dist/battery/README.md +102 -0
- package/dist/bottom-sheet/README.md +397 -0
- package/dist/button/README.md +205 -0
- package/dist/button/index.css +1 -1
- package/dist/button/index.wxss +1 -1
- package/dist/calendar/README.md +466 -0
- package/dist/cascader/README.md +235 -0
- package/dist/cell/README.md +240 -0
- package/dist/checkbox/README.md +359 -0
- package/dist/circle/README.md +116 -0
- package/dist/col/README.md +134 -0
- package/dist/collapse/README.md +223 -0
- package/dist/common/README.md +71 -0
- package/dist/config-provider/README.md +143 -0
- package/dist/count-down/README.md +194 -0
- package/dist/custom-keyboard/README.md +119 -0
- package/dist/datetime-picker/README.md +384 -0
- package/dist/dialog/README.md +412 -0
- package/dist/divider/README.md +100 -0
- package/dist/dropdown-menu/README.md +278 -0
- package/dist/empty/README.md +101 -0
- package/dist/field/README.md +439 -0
- package/dist/grid/README.md +197 -0
- package/dist/icon/README.md +143 -0
- package/dist/image/README.md +171 -0
- package/dist/index-bar/README.md +189 -0
- package/dist/loading/README.md +86 -0
- package/dist/nav-bar/README.md +378 -0
- package/dist/normal-slider/README.md +325 -0
- package/dist/notice-bar/README.md +216 -0
- package/dist/notify/README.md +120 -0
- package/dist/overlay/README.md +132 -0
- package/dist/picker/README.md +396 -0
- package/dist/popover/README.md +249 -0
- package/dist/popup/README.md +162 -0
- package/dist/progress/README.md +99 -0
- package/dist/radio/README.md +303 -0
- package/dist/rate/README.md +176 -0
- package/dist/search/README.md +235 -0
- package/dist/sidebar/README.md +160 -0
- package/dist/skeleton/README.md +98 -0
- package/dist/slider/README.md +366 -0
- package/dist/stepper/README.md +208 -0
- package/dist/sticky/README.md +124 -0
- package/dist/swipe-cell/README.md +172 -0
- package/dist/switch/README.md +204 -0
- package/dist/tab/README.md +414 -0
- package/dist/tabbar/README.md +333 -0
- package/dist/tag/README.md +184 -0
- package/dist/toast/README.md +220 -0
- package/dist/transition/README.md +114 -0
- package/dist/tree-select/README.md +199 -0
- package/lib/action-sheet/README.md +631 -0
- package/lib/battery/README.md +102 -0
- package/lib/bottom-sheet/README.md +397 -0
- package/lib/button/README.md +205 -0
- package/lib/button/index.css +1 -1
- package/lib/button/index.wxss +1 -1
- package/lib/calendar/README.md +466 -0
- package/lib/cascader/README.md +235 -0
- package/lib/cell/README.md +240 -0
- package/lib/checkbox/README.md +359 -0
- package/lib/circle/README.md +116 -0
- package/lib/col/README.md +134 -0
- package/lib/collapse/README.md +223 -0
- package/lib/common/README.md +71 -0
- package/lib/config-provider/README.md +143 -0
- package/lib/count-down/README.md +194 -0
- package/lib/custom-keyboard/README.md +119 -0
- package/lib/datetime-picker/README.md +384 -0
- package/lib/dialog/README.md +412 -0
- package/lib/divider/README.md +100 -0
- package/lib/dropdown-menu/README.md +278 -0
- package/lib/empty/README.md +101 -0
- package/lib/field/README.md +439 -0
- package/lib/grid/README.md +197 -0
- package/lib/icon/README.md +143 -0
- package/lib/image/README.md +171 -0
- package/lib/index-bar/README.md +189 -0
- package/lib/loading/README.md +86 -0
- package/lib/nav-bar/README.md +378 -0
- package/lib/normal-slider/README.md +325 -0
- package/lib/notice-bar/README.md +216 -0
- package/lib/notify/README.md +120 -0
- package/lib/overlay/README.md +132 -0
- package/lib/picker/README.md +396 -0
- package/lib/popover/README.md +249 -0
- package/lib/popup/README.md +162 -0
- package/lib/progress/README.md +99 -0
- package/lib/radio/README.md +303 -0
- package/lib/rate/README.md +176 -0
- package/lib/search/README.md +235 -0
- package/lib/sidebar/README.md +160 -0
- package/lib/skeleton/README.md +98 -0
- package/lib/slider/README.md +366 -0
- package/lib/stepper/README.md +208 -0
- package/lib/sticky/README.md +124 -0
- package/lib/swipe-cell/README.md +172 -0
- package/lib/switch/README.md +204 -0
- package/lib/tab/README.md +414 -0
- package/lib/tabbar/README.md +333 -0
- package/lib/tag/README.md +184 -0
- package/lib/toast/README.md +220 -0
- package/lib/transition/README.md +114 -0
- package/lib/tree-select/README.md +199 -0
- package/package.json +1 -1
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
---
|
|
2
|
+
category: 数据录入
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Checkbox 复选框
|
|
6
|
+
|
|
7
|
+
### 介绍
|
|
8
|
+
|
|
9
|
+
在一组备选项中进行多选。
|
|
10
|
+
|
|
11
|
+
### 引入
|
|
12
|
+
|
|
13
|
+
在`app.json`或`index.json`中引入组件,详细介绍见[快速上手](/material/smartui?comId=help-getting-started&appType=miniapp)。
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"usingComponents": {
|
|
17
|
+
"smart-checkbox": "@tuya-miniapp/smart-ui/lib/checkbox/index",
|
|
18
|
+
"smart-checkbox-group": "@tuya-miniapp/smart-ui/lib/checkbox-group/index"
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 代码演示
|
|
23
|
+
|
|
24
|
+
### 基础用法
|
|
25
|
+
|
|
26
|
+
通过`value`绑定复选框的勾选状态。
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<smart-checkbox
|
|
30
|
+
value="{{ checked }}"
|
|
31
|
+
custom-class="demo-checkbox-inline"
|
|
32
|
+
bind:change="onChange"
|
|
33
|
+
/>
|
|
34
|
+
<smart-checkbox
|
|
35
|
+
value="{{ checked ? false : true }}"
|
|
36
|
+
custom-class="demo-checkbox-inline"
|
|
37
|
+
bind:change="onChange2"
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
Page({
|
|
43
|
+
data: {
|
|
44
|
+
checked: true,
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
onChange(event) {
|
|
48
|
+
this.setData({ checked: event.detail });
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
onChange2(event) {
|
|
52
|
+
this.setData({ checked: !event.detail });
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 禁用状态
|
|
58
|
+
|
|
59
|
+
通过设置`disabled`属性可以禁用复选框。
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<smart-checkbox
|
|
63
|
+
disabled
|
|
64
|
+
value="{{ false }}"
|
|
65
|
+
custom-class="demo-checkbox-inline"
|
|
66
|
+
/>
|
|
67
|
+
<smart-checkbox
|
|
68
|
+
disabled
|
|
69
|
+
value="{{ true }}"
|
|
70
|
+
custom-class="demo-checkbox-inline"
|
|
71
|
+
/>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 自定义形状
|
|
75
|
+
|
|
76
|
+
将`shape`属性设置为`square`,复选框的形状会变成方形。
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<smart-checkbox
|
|
80
|
+
value="{{ checked }}"
|
|
81
|
+
shape="square"
|
|
82
|
+
custom-class="demo-checkbox-inline"
|
|
83
|
+
bind:change="onChange"
|
|
84
|
+
/>
|
|
85
|
+
<smart-checkbox
|
|
86
|
+
value="{{ checked ? false : true }}"
|
|
87
|
+
shape="square"
|
|
88
|
+
custom-class="demo-checkbox-inline"
|
|
89
|
+
bind:change="onChange2"
|
|
90
|
+
/>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 自定义颜色
|
|
94
|
+
|
|
95
|
+
通过`checked-color`属性可以自定义选中状态下的图标颜色。
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<smart-checkbox
|
|
99
|
+
value="{{ checked }}"
|
|
100
|
+
checked-color="#10D0D0"
|
|
101
|
+
custom-class="demo-checkbox-inline"
|
|
102
|
+
bind:change="onChange"
|
|
103
|
+
/>
|
|
104
|
+
<smart-checkbox
|
|
105
|
+
value="{{ checked ? false : true }}"
|
|
106
|
+
checked-color="#10D0D0"
|
|
107
|
+
custom-class="demo-checkbox-inline"
|
|
108
|
+
bind:change="onChange2"
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 自定义大小
|
|
113
|
+
|
|
114
|
+
通过`icon-size`属性可以自定义图标的大小。
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<smart-checkbox
|
|
118
|
+
icon-size="28px"
|
|
119
|
+
value="{{ checked }}"
|
|
120
|
+
custom-class="demo-checkbox-inline"
|
|
121
|
+
bind:change="onChange"
|
|
122
|
+
/>
|
|
123
|
+
<smart-checkbox
|
|
124
|
+
icon-size="28px"
|
|
125
|
+
value="{{ checked ? false : true }}"
|
|
126
|
+
custom-class="demo-checkbox-inline"
|
|
127
|
+
bind:change="onChange2"
|
|
128
|
+
/>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 展示文本
|
|
132
|
+
|
|
133
|
+
通过 slot 子节点可展示文本
|
|
134
|
+
|
|
135
|
+
<smart-checkbox
|
|
136
|
+
value="{{ checked }}"
|
|
137
|
+
bind:change="onChange"
|
|
138
|
+
>
|
|
139
|
+
自定义文本
|
|
140
|
+
</smart-checkbox>
|
|
141
|
+
|
|
142
|
+
### 自定义图标
|
|
143
|
+
|
|
144
|
+
通过 `icon` 配合 `use-icon-slot` 插槽自定义图标。
|
|
145
|
+
|
|
146
|
+
```html
|
|
147
|
+
<smart-checkbox
|
|
148
|
+
use-icon-slot
|
|
149
|
+
value="{{ checked }}"
|
|
150
|
+
bind:change="onChange"
|
|
151
|
+
>
|
|
152
|
+
自定义图标
|
|
153
|
+
<image
|
|
154
|
+
slot="icon"
|
|
155
|
+
class="icon"
|
|
156
|
+
mode="widthFix"
|
|
157
|
+
src="{{ checked ? activeIcon : inactiveIcon }}"
|
|
158
|
+
/>
|
|
159
|
+
</smart-checkbox>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```js
|
|
163
|
+
Page({
|
|
164
|
+
data: {
|
|
165
|
+
checked: true,
|
|
166
|
+
activeIcon: 'https://images.tuyacn.com/content-platform/hestia/1730877912e76cbdb7563.png',
|
|
167
|
+
inactiveIcon: '',
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
onChange(event) {
|
|
171
|
+
this.setData({
|
|
172
|
+
checked: event.detail,
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 禁用文本点击
|
|
179
|
+
|
|
180
|
+
通过设置`label-disabled`属性可以禁用复选框文本点击。
|
|
181
|
+
|
|
182
|
+
```html
|
|
183
|
+
<smart-checkbox
|
|
184
|
+
label-disabled
|
|
185
|
+
value="{{ checked }}"
|
|
186
|
+
bind:change="onChange"
|
|
187
|
+
>
|
|
188
|
+
Checkbox 复选框
|
|
189
|
+
</smart-checkbox>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 复选框组
|
|
193
|
+
|
|
194
|
+
需要与`smart-checkbox-group`一起使用,选中值是一个数组,通过`value`绑定在`smart-checkbox-group`上,数组中的项即为选中的`Checkbox`的`name`属性设置的值。
|
|
195
|
+
|
|
196
|
+
```html
|
|
197
|
+
<smart-checkbox-group value="{{ result }}" bind:change="onChange">
|
|
198
|
+
<smart-checkbox name="a">Checkbox 复选框 a</smart-checkbox>
|
|
199
|
+
<smart-checkbox name="b">Checkbox 复选框 b</smart-checkbox>
|
|
200
|
+
<smart-checkbox name="c">Checkbox 复选框 c</smart-checkbox>
|
|
201
|
+
</smart-checkbox-group>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
Page({
|
|
206
|
+
data: {
|
|
207
|
+
result: ['a', 'b'],
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
onChange(event) {
|
|
211
|
+
this.setData({
|
|
212
|
+
result: event.detail,
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 限制最大可选数
|
|
219
|
+
|
|
220
|
+
```html
|
|
221
|
+
<smart-checkbox-group value="{{ result }}" bind:change="onChange" max="{{ 2 }}">
|
|
222
|
+
<smart-checkbox name="a">复选框 a</smart-checkbox>
|
|
223
|
+
<smart-checkbox name="b">复选框 b</smart-checkbox>
|
|
224
|
+
<smart-checkbox name="c">复选框 c</smart-checkbox>
|
|
225
|
+
</smart-checkbox-group>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### 搭配单元格组件使用
|
|
229
|
+
|
|
230
|
+
此时你需要再引入`Cell`和`CellGroup`组件,并通过 checkbox 的 toggle 方法手动触发切换。
|
|
231
|
+
|
|
232
|
+
```html
|
|
233
|
+
<smart-checkbox-group value="{{ result }}" bind:change="onChange">
|
|
234
|
+
<smart-cell-group>
|
|
235
|
+
<smart-cell
|
|
236
|
+
wx:for="{{ list }}"
|
|
237
|
+
wx:key="index"
|
|
238
|
+
title="复选框 {{ item }}"
|
|
239
|
+
value-class="value-class"
|
|
240
|
+
clickable
|
|
241
|
+
data-index="{{ index }}"
|
|
242
|
+
bind:click="toggle"
|
|
243
|
+
>
|
|
244
|
+
<smart-checkbox
|
|
245
|
+
catch:tap="noop"
|
|
246
|
+
class="checkboxes-{{ index }}"
|
|
247
|
+
name="{{ item }}"
|
|
248
|
+
/>
|
|
249
|
+
</smart-cell>
|
|
250
|
+
</smart-cell-group>
|
|
251
|
+
</smart-checkbox-group>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
```js
|
|
255
|
+
Page({
|
|
256
|
+
data: {
|
|
257
|
+
list: ['a', 'b', 'c'],
|
|
258
|
+
result: ['a', 'b'],
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
onChange(event) {
|
|
262
|
+
this.setData({
|
|
263
|
+
result: event.detail,
|
|
264
|
+
});
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
toggle(event) {
|
|
268
|
+
const { index } = event.currentTarget.dataset;
|
|
269
|
+
const checkbox = this.selectComponent(`.checkboxes-${index}`);
|
|
270
|
+
checkbox.toggle();
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
noop() {},
|
|
274
|
+
});
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
```css
|
|
278
|
+
.value-class {
|
|
279
|
+
flex: none !important;
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## API
|
|
284
|
+
|
|
285
|
+
### Checkbox Props
|
|
286
|
+
|
|
287
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
288
|
+
| -------------- | ------------------------------- | ------------------ | --------- |
|
|
289
|
+
| checked-color | 选中状态颜色 | _string_ | `#1989fa` |
|
|
290
|
+
| disabled | 是否禁用单选框 | _boolean_ | `false` |
|
|
291
|
+
| icon-size | icon 大小 | _string \| number_ | `24px` |
|
|
292
|
+
| label-disabled | 是否禁用单选框内容点击 | _boolean_ | `false` |
|
|
293
|
+
| label-position | 文本位置,可选值为 `left` | _string_ | `right` |
|
|
294
|
+
| name | 标识 Checkbox 名称 | _string_ | - |
|
|
295
|
+
| shape | 形状,可选值为 `round` `square` | _string_ | `round` |
|
|
296
|
+
| use-icon-slot | 是否使用 icon slot | _boolean_ | `false` |
|
|
297
|
+
| value | 是否为选中状态 | _boolean_ | `false` |
|
|
298
|
+
|
|
299
|
+
### CheckboxGroup Props
|
|
300
|
+
|
|
301
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
302
|
+
| ------------------ | ------------------------------- | --------- | ------------- |
|
|
303
|
+
| direction | 排列方向,可选值为 `horizontal` | _string_ | `vertical` |
|
|
304
|
+
| disabled | 是否禁用所有单选框 | _boolean_ | `false` |
|
|
305
|
+
| max | 设置最大可选数 | _number_ | `0`(无限制) |
|
|
306
|
+
| name | 在表单内提交时的标识符 | _string_ | - |
|
|
307
|
+
| value | 所有选中项的 name | _Array_ | - |
|
|
308
|
+
|
|
309
|
+
### Checkbox Event
|
|
310
|
+
|
|
311
|
+
| 事件名 | 说明 | 回调参数 |
|
|
312
|
+
| ----------- | ------------------------ | ------------ |
|
|
313
|
+
| bind:change | 当绑定值变化时触发的事件 | 当前组件的值 |
|
|
314
|
+
|
|
315
|
+
### Checkbox 外部样式类
|
|
316
|
+
|
|
317
|
+
| 类名 | 说明 |
|
|
318
|
+
| ------------ | -------------- |
|
|
319
|
+
| custom-class | 根节点样式类 |
|
|
320
|
+
| icon-class | 图标样式类 |
|
|
321
|
+
| label-class | 描述信息样式类 |
|
|
322
|
+
|
|
323
|
+
### CheckboxGroup Event
|
|
324
|
+
|
|
325
|
+
| 事件名 | 说明 | 回调参数 |
|
|
326
|
+
| ----------- | ------------------------ | ------------ |
|
|
327
|
+
| bind:change | 当绑定值变化时触发的事件 | 当前组件的值 |
|
|
328
|
+
|
|
329
|
+
### Checkbox Slot
|
|
330
|
+
|
|
331
|
+
| 名称 | 说明 |
|
|
332
|
+
| ---- | ---------- |
|
|
333
|
+
| - | 自定义文本 |
|
|
334
|
+
| icon | 自定义图标 |
|
|
335
|
+
|
|
336
|
+
### Checkbox 方法
|
|
337
|
+
|
|
338
|
+
通过 [selectComponent](/material/smartui?comId=faq&appType=miniapp) 可以获取到 checkbox 实例并调用实例方法。
|
|
339
|
+
|
|
340
|
+
| 方法名 | 参数 | 返回值 | 介绍 |
|
|
341
|
+
| ------ | ---- | ------ | ------------ |
|
|
342
|
+
| toggle | - | - | 切换选中状态 |
|
|
343
|
+
|
|
344
|
+
### 样式变量
|
|
345
|
+
|
|
346
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
|
|
347
|
+
|
|
348
|
+
| 名称 | 默认值 | 描述 |
|
|
349
|
+
| ----------------------------- | -------------------------------------- | ---- |
|
|
350
|
+
| --checkbox-size | _24px_ | 复选框的大小 |
|
|
351
|
+
| --checkbox-border-color | _var(--app-B6-N6, rgba(0, 0, 0, 0.2))_ | 复选框的边框颜色 |
|
|
352
|
+
| --checkbox-border-radius | _4px_ | 复选框的边框圆角 |
|
|
353
|
+
| --checkbox-transition-duration| _0.2s_ | 复选框的过渡持续时间 |
|
|
354
|
+
| --checkbox-label-size | _12px_ | 复选框标签的字体大小 |
|
|
355
|
+
| --checkbox-label-margin | _10px_ | 复选框标签的外边距 |
|
|
356
|
+
| --checkbox-label-color | _var(--app-B6-N1, rgba(0, 0, 0, 1))_ | 复选框标签的颜色 |
|
|
357
|
+
| --checkbox-checked-icon-color | _@M4_ | 复选框选中状态的图标颜色 |
|
|
358
|
+
| --checkbox-disabled-label-color| _var(--app-B6-N1, rgba(0, 0, 0, 1))_ | 禁用状态下复选框标签的颜色 |
|
|
359
|
+
| --checkbox-disabled-opacity | _0.3_ | 禁用状态下复选框的透明度 |
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
category: 展示
|
|
3
|
+
new: true
|
|
4
|
+
version: v2.3.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Circle 环形进度条
|
|
8
|
+
|
|
9
|
+
### 介绍
|
|
10
|
+
|
|
11
|
+
圆环形的进度条组件,支持进度渐变动画。
|
|
12
|
+
|
|
13
|
+
> v2.3.0 之后重构
|
|
14
|
+
|
|
15
|
+
### 引入
|
|
16
|
+
|
|
17
|
+
在`app.json`或`index.json`中引入组件,详细介绍见[快速上手](/material/smartui?comId=help-getting-started&appType=miniapp)。
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
"usingComponents": {
|
|
21
|
+
"smart-circle": "@tuya-miniapp/smart-ui/lib/circle/index"
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```warning:⚠️注意
|
|
26
|
+
从 v2.3.9 开始将不支持微信小程序。
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 代码演示
|
|
30
|
+
|
|
31
|
+
### 基础用法
|
|
32
|
+
|
|
33
|
+
`percent`属性表示进度条的目标进度。
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<smart-circle percent="{{50}}" trackWidth="{{10}}"></smart-circle>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 缺口圆角
|
|
40
|
+
|
|
41
|
+
`mode`属性表示类型,angle、angle2 为半圆类型,`angle-offset` `v2.8.0` 属性用于设置半圆类型(`angle`、`angle2`)的起始角度偏移,单位为度。值越大,圆环的缺口越大。默认值为 -1,表示使用默认偏移。
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<smart-circle percent="{{50}}" mode="angle">
|
|
45
|
+
</smart-circle>
|
|
46
|
+
<smart-circle percent="{{50}}" mode="angle2">
|
|
47
|
+
</smart-circle>
|
|
48
|
+
<smart-circle percent="{{50}}" mode="angle2" angle-offset="{{30}}">
|
|
49
|
+
</smart-circle>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 不使用圆角
|
|
53
|
+
|
|
54
|
+
`round`属性设置为 false 为直角。
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<smart-circle percent="{{50}}" mode="angle" round="{{false}}">
|
|
58
|
+
</smart-circle>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 自定义颜色
|
|
62
|
+
|
|
63
|
+
`fillColor` 可设置自定义颜色,`fillColorStops` 设置渐变色,
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<smart-circle percent="{{50}}" mode="angle" round="{{false}}" fillColor="#DE23CB">
|
|
67
|
+
</smart-circle>
|
|
68
|
+
<smart-circle percent="{{50}}" mode="angle" round="{{false}}" fillColorStops="{{gradientColor}}">
|
|
69
|
+
</smart-circle>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
Page({
|
|
74
|
+
data: {
|
|
75
|
+
gradientColor: {
|
|
76
|
+
'0%': '#2361DE',
|
|
77
|
+
'50%': '#23DEB5',
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 自定义宽度
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<smart-circle percent="{{60}}" trackWidth="15" mode="angle" round="{{false}}">
|
|
87
|
+
</smart-circle>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## API
|
|
91
|
+
|
|
92
|
+
### props
|
|
93
|
+
|
|
94
|
+
| 属性名 | 描述 | 类型 | 默认值 |
|
|
95
|
+
| -------------------------- | -------- | ------------- | -------------------------- |
|
|
96
|
+
| angle-offset `v2.8.0` | 角度偏移 | number | -1 |
|
|
97
|
+
| children | 子元素 | ReactNode | undefined |
|
|
98
|
+
| class-name | 类名 | string | undefined |
|
|
99
|
+
| custom-style `v2.3.3` | 样式 | CSSProperties | undefined |
|
|
100
|
+
| fill-color | 填充颜色 | string | '#007AFF' |
|
|
101
|
+
| mask-color | 遮罩颜色 | string | 'transparent' |
|
|
102
|
+
| mode `v2.3.0` | 样式风格 | string | `basic`、`angle`、`angle2` |
|
|
103
|
+
| percent | 百分比 | number | 0 |
|
|
104
|
+
| round `v2.3.0` | 遮罩颜色 | string | `true` |
|
|
105
|
+
| size | 尺寸 | string | '100px' |
|
|
106
|
+
| style `@deprecated v2.1.7` | 样式 | CSSProperties | undefined |
|
|
107
|
+
| track-color | 滑槽颜色 | string | '#d3d3d3' |
|
|
108
|
+
| track-width | 滑槽宽度 | number | 10 |
|
|
109
|
+
|
|
110
|
+
### 样式变量
|
|
111
|
+
|
|
112
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
|
|
113
|
+
|
|
114
|
+
| 名称 | 默认值 | 描述 |
|
|
115
|
+
| ---------------------------------------- | --------- | ---------------- |
|
|
116
|
+
| --circle-text-color `@deprecated v2.3.0` | _#323233_ | 圆环内的文字颜色 |
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
category: 布局
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Layout 布局
|
|
6
|
+
|
|
7
|
+
### 介绍
|
|
8
|
+
|
|
9
|
+
Layout 提供了`smart-row`和`smart-col`两个组件来进行行列布局。
|
|
10
|
+
|
|
11
|
+
### 引入
|
|
12
|
+
|
|
13
|
+
在`app.json`或`index.json`中引入组件,详细介绍见[快速上手](/material/smartui?comId=help-getting-started&appType=miniapp)。
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"usingComponents": {
|
|
17
|
+
"smart-row": "@tuya-miniapp/smart-ui/lib/row/index",
|
|
18
|
+
"smart-col": "@tuya-miniapp/smart-ui/lib/col/index"
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 代码演示
|
|
23
|
+
|
|
24
|
+
### 基本用法
|
|
25
|
+
|
|
26
|
+
Layout 组件提供了`24列栅格`,通过在`Col`上添加`span`属性设置列所占的宽度百分比。此外,添加`offset`属性可以设置列的偏移宽度,计算方式与 span 相同。
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<smart-row>
|
|
30
|
+
<smart-col span="8" custom-class="dark">span: 8</smart-col>
|
|
31
|
+
<smart-col span="8" custom-class="light">span: 8</smart-col>
|
|
32
|
+
<smart-col span="8" custom-class="dark">span: 8</smart-col>
|
|
33
|
+
</smart-row>
|
|
34
|
+
|
|
35
|
+
<smart-row>
|
|
36
|
+
<smart-col span="4" custom-class="dark">span: 4</smart-col>
|
|
37
|
+
<smart-col span="10" offset="4" custom-class="light">offset: 4, span: 10</smart-col>
|
|
38
|
+
</smart-row>
|
|
39
|
+
|
|
40
|
+
<smart-row>
|
|
41
|
+
<smart-col offset="12" span="12" custom-class="dark">offset: 12, span: 12</smart-col>
|
|
42
|
+
</smart-row>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
less样式:
|
|
46
|
+
|
|
47
|
+
```less
|
|
48
|
+
.dark,
|
|
49
|
+
.light {
|
|
50
|
+
color: #fff;
|
|
51
|
+
font-size: 13px;
|
|
52
|
+
line-height: 30px;
|
|
53
|
+
text-align: center;
|
|
54
|
+
margin-bottom: 10px;
|
|
55
|
+
background-clip: content-box;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.dark {
|
|
59
|
+
background-color: #39a9ed;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.light {
|
|
63
|
+
background-color: #66c6f2;
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 设置列元素间距
|
|
68
|
+
|
|
69
|
+
通过`gutter`属性可以设置列元素之间的间距,默认间距为 0。
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<smart-row gutter="20">
|
|
73
|
+
<smart-col span="8" custom-class="dark">span: 8</smart-col>
|
|
74
|
+
<smart-col span="8" custom-class="light">span: 8</smart-col>
|
|
75
|
+
<smart-col span="8" custom-class="dark">span: 8</smart-col>
|
|
76
|
+
</smart-row>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
less样式:
|
|
80
|
+
|
|
81
|
+
```less
|
|
82
|
+
.dark,
|
|
83
|
+
.light {
|
|
84
|
+
color: #fff;
|
|
85
|
+
font-size: 13px;
|
|
86
|
+
line-height: 30px;
|
|
87
|
+
text-align: center;
|
|
88
|
+
margin-bottom: 10px;
|
|
89
|
+
background-clip: content-box;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.dark {
|
|
93
|
+
background-color: #39a9ed;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.light {
|
|
97
|
+
background-color: #66c6f2;
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## API
|
|
102
|
+
|
|
103
|
+
### Row Props
|
|
104
|
+
|
|
105
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
106
|
+
| ------ | ----------------------------- | ------------------ | ------ |
|
|
107
|
+
| gutter | 列元素之间的间距(单位为 px) | _string \| number_ | - |
|
|
108
|
+
|
|
109
|
+
### Col Props
|
|
110
|
+
|
|
111
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
112
|
+
| ------ | -------------- | ------------------ | ------ |
|
|
113
|
+
| offset | 列元素偏移距离 | _string \| number_ | - |
|
|
114
|
+
| span | 列元素宽度 | _string \| number_ | - |
|
|
115
|
+
|
|
116
|
+
### 外部样式类
|
|
117
|
+
|
|
118
|
+
| 类名 | 说明 |
|
|
119
|
+
| ------------ | ------------ |
|
|
120
|
+
| custom-class | 根节点样式类 |
|
|
121
|
+
|
|
122
|
+
### 样式变量
|
|
123
|
+
|
|
124
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
|
|
125
|
+
|
|
126
|
+
| 名称 | 默认值 | 描述 |
|
|
127
|
+
| --------------------------------------------- | -------------------------------------------- | ------------------------------------------ |
|
|
128
|
+
| --collapse-item-transition-duration | _0.3s_ | 折叠项过渡持续时间 |
|
|
129
|
+
| --collapse-item-content-padding | _15px_ | 折叠项内容内边距 |
|
|
130
|
+
| --collapse-item-content-font-size | _13px_ | 折叠项内容字体大小 |
|
|
131
|
+
| --collapse-item-content-line-height | _1.5_ | 折叠项内容行高 |
|
|
132
|
+
| --collapse-item-content-text-color | _#969799_ | 折叠项内容文本颜色 |
|
|
133
|
+
| --collapse-item-content-background-color | _var(--app-B6, #fff)_ | 折叠项内容背景颜色 |
|
|
134
|
+
| --collapse-item-title-disabled-color | _#c8c9cc_ | 折叠项标题禁用状态颜色 |
|