@tuya-miniapp/smart-ui 2.13.2-beta-0 → 2.13.2-beta-1

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.
Files changed (107) hide show
  1. package/dist/action-sheet/README.md +631 -0
  2. package/dist/battery/README.md +102 -0
  3. package/dist/bottom-sheet/README.md +397 -0
  4. package/dist/button/README.md +205 -0
  5. package/dist/button/index.css +1 -1
  6. package/dist/button/index.wxss +1 -1
  7. package/dist/calendar/README.md +466 -0
  8. package/dist/cascader/README.md +235 -0
  9. package/dist/cell/README.md +240 -0
  10. package/dist/checkbox/README.md +359 -0
  11. package/dist/circle/README.md +116 -0
  12. package/dist/col/README.md +134 -0
  13. package/dist/collapse/README.md +223 -0
  14. package/dist/common/README.md +71 -0
  15. package/dist/config-provider/README.md +143 -0
  16. package/dist/count-down/README.md +194 -0
  17. package/dist/custom-keyboard/README.md +119 -0
  18. package/dist/datetime-picker/README.md +384 -0
  19. package/dist/dialog/README.md +412 -0
  20. package/dist/divider/README.md +100 -0
  21. package/dist/dropdown-menu/README.md +278 -0
  22. package/dist/empty/README.md +101 -0
  23. package/dist/field/README.md +439 -0
  24. package/dist/grid/README.md +197 -0
  25. package/dist/icon/README.md +143 -0
  26. package/dist/image/README.md +171 -0
  27. package/dist/index-bar/README.md +189 -0
  28. package/dist/loading/README.md +86 -0
  29. package/dist/nav-bar/README.md +378 -0
  30. package/dist/normal-slider/README.md +325 -0
  31. package/dist/notice-bar/README.md +216 -0
  32. package/dist/notify/README.md +120 -0
  33. package/dist/overlay/README.md +132 -0
  34. package/dist/picker/README.md +396 -0
  35. package/dist/popover/README.md +249 -0
  36. package/dist/popup/README.md +162 -0
  37. package/dist/progress/README.md +99 -0
  38. package/dist/radio/README.md +303 -0
  39. package/dist/rate/README.md +176 -0
  40. package/dist/search/README.md +235 -0
  41. package/dist/sidebar/README.md +160 -0
  42. package/dist/skeleton/README.md +98 -0
  43. package/dist/slider/README.md +366 -0
  44. package/dist/stepper/README.md +208 -0
  45. package/dist/sticky/README.md +124 -0
  46. package/dist/swipe-cell/README.md +172 -0
  47. package/dist/switch/README.md +204 -0
  48. package/dist/tab/README.md +414 -0
  49. package/dist/tabbar/README.md +333 -0
  50. package/dist/tag/README.md +184 -0
  51. package/dist/toast/README.md +220 -0
  52. package/dist/transition/README.md +114 -0
  53. package/dist/tree-select/README.md +199 -0
  54. package/lib/action-sheet/README.md +631 -0
  55. package/lib/battery/README.md +102 -0
  56. package/lib/bottom-sheet/README.md +397 -0
  57. package/lib/button/README.md +205 -0
  58. package/lib/button/index.css +1 -1
  59. package/lib/button/index.wxss +1 -1
  60. package/lib/calendar/README.md +466 -0
  61. package/lib/cascader/README.md +235 -0
  62. package/lib/cell/README.md +240 -0
  63. package/lib/checkbox/README.md +359 -0
  64. package/lib/circle/README.md +116 -0
  65. package/lib/col/README.md +134 -0
  66. package/lib/collapse/README.md +223 -0
  67. package/lib/common/README.md +71 -0
  68. package/lib/config-provider/README.md +143 -0
  69. package/lib/count-down/README.md +194 -0
  70. package/lib/custom-keyboard/README.md +119 -0
  71. package/lib/datetime-picker/README.md +384 -0
  72. package/lib/dialog/README.md +412 -0
  73. package/lib/divider/README.md +100 -0
  74. package/lib/dropdown-menu/README.md +278 -0
  75. package/lib/empty/README.md +101 -0
  76. package/lib/field/README.md +439 -0
  77. package/lib/grid/README.md +197 -0
  78. package/lib/icon/README.md +143 -0
  79. package/lib/image/README.md +171 -0
  80. package/lib/index-bar/README.md +189 -0
  81. package/lib/loading/README.md +86 -0
  82. package/lib/nav-bar/README.md +378 -0
  83. package/lib/normal-slider/README.md +325 -0
  84. package/lib/notice-bar/README.md +216 -0
  85. package/lib/notify/README.md +120 -0
  86. package/lib/overlay/README.md +132 -0
  87. package/lib/picker/README.md +396 -0
  88. package/lib/popover/README.md +249 -0
  89. package/lib/popup/README.md +162 -0
  90. package/lib/progress/README.md +99 -0
  91. package/lib/radio/README.md +303 -0
  92. package/lib/rate/README.md +176 -0
  93. package/lib/search/README.md +235 -0
  94. package/lib/sidebar/README.md +160 -0
  95. package/lib/skeleton/README.md +98 -0
  96. package/lib/slider/README.md +366 -0
  97. package/lib/stepper/README.md +208 -0
  98. package/lib/sticky/README.md +124 -0
  99. package/lib/swipe-cell/README.md +172 -0
  100. package/lib/switch/README.md +204 -0
  101. package/lib/tab/README.md +414 -0
  102. package/lib/tabbar/README.md +333 -0
  103. package/lib/tag/README.md +184 -0
  104. package/lib/toast/README.md +220 -0
  105. package/lib/transition/README.md +114 -0
  106. package/lib/tree-select/README.md +199 -0
  107. package/package.json +1 -1
@@ -0,0 +1,631 @@
1
+ ---
2
+ category: 反馈
3
+ ---
4
+
5
+ # ActionSheet 动作面板
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-action-sheet": "@tuya-miniapp/smart-ui/lib/action-sheet/index"
18
+ }
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础用法
24
+
25
+ 需要传入一个`actions`的数组,数组的每一项是一个对象,对象属性见文档下方表格。
26
+
27
+ ```html
28
+ <smart-action-sheet
29
+ show="{{ show }}"
30
+ actions="{{ actions }}"
31
+ bind:close="onClose"
32
+ bind:cancel="onCancel"
33
+ bind:select="onSelect"
34
+ />
35
+ ```
36
+
37
+ ```javascript
38
+ Page({
39
+ data: {
40
+ show: false,
41
+ actions: [
42
+ { id: 0, name: 'Action', checked: true },
43
+ { id: 1, name: 'Action', checked: false },
44
+ { id: 2, name: 'Action', checked: false },
45
+ { id: 3, name: 'Action', checked: false },
46
+ { id: 4, name: 'Action', checked: false },
47
+ { id: 5, name: 'Action', checked: false },
48
+ { id: 6, name: 'Action', checked: false },
49
+ { id: 7, name: 'Action', checked: false },
50
+ ],
51
+ },
52
+
53
+ onCancel() {
54
+ this.setData({ show: false });
55
+ },
56
+
57
+ onClose() {
58
+ console.log('close')
59
+ },
60
+
61
+ onSelect(event) {
62
+ console.log(event.detail);
63
+ },
64
+ });
65
+ ```
66
+
67
+ ### 自定义选中 icon 颜色
68
+
69
+ 通过`active-color`属性可以自定义选中状态下图标的颜色。
70
+
71
+ ```html
72
+ <smart-action-sheet
73
+ show="{{ show }}"
74
+ actions="{{ actions }}"
75
+ active-color="#1989FA"
76
+ cancel-text="取消"
77
+ bind:select="onSelect"
78
+ bind:close="onClose"
79
+ bind:cancel="onClose"
80
+ />
81
+ ```
82
+
83
+ ```javascript
84
+ Page({
85
+ data: {
86
+ show: false,
87
+ actions: [
88
+ { id: 0, name: 'Action', checked: true },
89
+ { id: 1, name: 'Action', checked: false },
90
+ { id: 2, name: 'Action', checked: false },
91
+ ],
92
+ },
93
+
94
+ onClose() {
95
+ this.setData({ show: false });
96
+ },
97
+
98
+ onSelect(event) {
99
+ const { id } = event.detail;
100
+ const newActions = this.data.actions.map((item) => {
101
+ if (item.id === id) return { ...item, checked: true };
102
+ return { ...item, checked: false };
103
+ });
104
+ this.setData({
105
+ actions: newActions,
106
+ });
107
+ },
108
+ });
109
+ ```
110
+
111
+ ### 无选中列表
112
+
113
+ 设置`actions[idx].checked`属性为`false`后,可以展示无选中状态的列表。
114
+
115
+ ```html
116
+ <smart-action-sheet
117
+ show="{{ show }}"
118
+ actions="{{ actions }}"
119
+ cancel-text="取消"
120
+ />
121
+ ```
122
+
123
+ ```javascript
124
+ Page({
125
+ data: {
126
+ show: false,
127
+ actions: [{ name: 'Action' }, { name: 'Action' }, { name: 'Action', subname: 'Description' }],
128
+ },
129
+ });
130
+ ```
131
+
132
+ ### 选项状态
133
+
134
+ 选项可以设置为加载状态或禁用状态。
135
+
136
+ ```html
137
+ <smart-action-sheet
138
+ show="{{ show }}"
139
+ actions="{{ actions }}"
140
+ cancel-text="取消"
141
+ />
142
+ ```
143
+
144
+ ```javascript
145
+ Page({
146
+ data: {
147
+ show: false,
148
+ actions: [
149
+ { name: '着色选项', color: '#ee0a24' },
150
+ { loading: true },
151
+ { name: '禁用选项', disabled: true },
152
+ ],
153
+ },
154
+ });
155
+ ```
156
+
157
+ ### 展示取消/确认按钮
158
+
159
+ 设置`cancel-text`、`confirm-text`属性后,会在底部展示取消或确认按钮,点击后关闭当前菜单。
160
+
161
+ ```html
162
+ <smart-action-sheet
163
+ show="{{ show }}"
164
+ actions="{{ actions }}"
165
+ cancel-text="取消"
166
+ confirm-text="确认"
167
+ />
168
+ ```
169
+
170
+ ### 展示描述信息
171
+
172
+ 设置`description`属性后,会在选项上方显示描述信息。
173
+
174
+ ```html
175
+ <smart-action-sheet
176
+ show="{{ show }}"
177
+ actions="{{ actions }}"
178
+ description="这是一段描述信息"
179
+ />
180
+ ```
181
+
182
+ ```javascript
183
+ Page({
184
+ data: {
185
+ show: false,
186
+ actions: [{ name: 'Action' }, { name: 'Action' }, { name: 'Action', subname: 'Description' }],
187
+ },
188
+ });
189
+ ```
190
+
191
+ ### 自定义面板
192
+
193
+ 通过设置`title`属性展示标题栏,同时可以使用插槽自定义菜单内容。
194
+
195
+ ```html
196
+ <smart-action-sheet show="{{ show }}" title="标题">
197
+ <view>内容</view>
198
+ </smart-action-sheet>
199
+ ```
200
+
201
+ ### 嵌入数字滑块
202
+
203
+ ActionSheet 内可以嵌入 Slider 等其他组件,需要注意在 `onAfterEnter` 回调后再渲染 Slider。
204
+
205
+ ```html
206
+ <smart-action-sheet
207
+ show="{{ show }}"
208
+ title="数值调节"
209
+ cancel-text="取消"
210
+ confirm-text="确认"
211
+ bind:close="onClose"
212
+ bind:cancel="onClose"
213
+ bind:confirm="onClose"
214
+ bind:after-enter="onAfterEnter"
215
+ >
216
+ <view class="content-number">
217
+ <view class="demo-header">
218
+ <text class="demo-text">{{ currentNumber }}%</text>
219
+ </view>
220
+ <view class="demo-slider">
221
+ <smart-slider
222
+ wx:if="{{ isReady }}"
223
+ instanceId="action-sheet-slider"
224
+ trackStyle="height:45px;border-radius:8px;"
225
+ barStyle="height:45px;border-radius:8px;"
226
+ thumbStyle="width:15px;height:50px;background:#BBC5D4;border:2px solid #FFFFFF;box-shadow:0px 0px 2px 0px rgba(0, 0, 0, 0.5);border-radius:2px;"
227
+ value="{{ currentNumber }}"
228
+ bind:change="onChange"
229
+ />
230
+ <view wx:else style="height: 45px;" />
231
+ </view>
232
+ </view>
233
+ </smart-action-sheet>
234
+ ```
235
+
236
+ ```javascript
237
+ Page({
238
+ data: {
239
+ show: false,
240
+ isReady: false,
241
+ currentNumber: 0,
242
+ },
243
+
244
+ onClose() {
245
+ this.setData({ show: false });
246
+ },
247
+
248
+ onAfterEnter() {
249
+ this.setData({ isReady: true })
250
+ },
251
+
252
+ onChange(event) {
253
+ this.setData({ currentNumber: event.detail.value });
254
+ },
255
+ });
256
+ ```
257
+
258
+ ```css
259
+ .content-number {
260
+ padding: 10px 39px;
261
+ background: var(--app-B1, #f6f7fb);
262
+ text-align: center;
263
+ color: var(--app-B4-N1, #000);
264
+ }
265
+
266
+ .demo-header {
267
+ padding: 10px 39px;
268
+ }
269
+
270
+ .demo-text {
271
+ font-size: 40px;
272
+ font-weight: 600;
273
+ line-height: 46px;
274
+ }
275
+
276
+ .demo-slider {
277
+ margin: 23px 0;
278
+ min-height: 45px;
279
+ }
280
+ ```
281
+
282
+ ### 嵌入日期选择器
283
+
284
+ ActionSheet 内可以嵌入日期选择器等其他组件。
285
+
286
+ ```html
287
+ <smart-action-sheet
288
+ show="{{ show }}"
289
+ title="选择日期"
290
+ cancel-text="取消"
291
+ confirm-text="确认"
292
+ bind:close="onClose"
293
+ bind:cancel="onClose"
294
+ bind:confirm="onPickerConfirm"
295
+ >
296
+ <smart-datetime-picker
297
+ show-toolbar="{{ false }}"
298
+ type="date"
299
+ value="{{ currentDate }}"
300
+ min-date="{{ minDate }}"
301
+ formatter="{{ formatter }}"
302
+ bind:input="onInput"
303
+ />
304
+ </smart-action-sheet>
305
+ ```
306
+
307
+ ```javascript
308
+ Page({
309
+ data: {
310
+ show: false,
311
+ currentDate: new Date(2018, 0, 1),
312
+ minDate: new Date(2018, 0, 1).getTime(),
313
+ formatter(type, value) {
314
+ if (type === 'year') {
315
+ return `${value}年`;
316
+ }
317
+ if (type === 'month') {
318
+ return `${value}月`;
319
+ }
320
+ return value;
321
+ },
322
+ },
323
+
324
+ onClose() {
325
+ this.setData({ show: false });
326
+ },
327
+
328
+ onInput(event) {
329
+ const { detail } = event;
330
+ const date = new Date(detail);
331
+ this.setData({ currentDate: date });
332
+ },
333
+
334
+ onPickerConfirm() {
335
+ this.setData({
336
+ show: false,
337
+ });
338
+ // 处理确认选择的日期
339
+ console.log('选择的日期:', this.data.currentDate);
340
+ },
341
+ });
342
+ ```
343
+
344
+ ### 自定义双列选择器 `v2.6.0`
345
+
346
+ 当 `use-title-slot` 为 `true` 时,可以使用插槽自定义标题内容,支持复杂的双选择器场景。
347
+
348
+ ```html
349
+ <smart-action-sheet
350
+ show="{{ show }}"
351
+ use-title-slot="{{ true }}"
352
+ cancel-text="取消"
353
+ confirm-text="确认"
354
+ bind:close="onClose"
355
+ bind:cancel="onClose"
356
+ bind:confirm="onDoubleSelectorConfirm"
357
+ >
358
+ <view slot="title" class="demo-custom-double-select-header">
359
+ <view>时间</view>
360
+ <view>温度</view>
361
+ </view>
362
+ <view class="demo-custom-double-select-content">
363
+ <smart-datetime-picker
364
+ class="flex1"
365
+ type="time"
366
+ data-type="time"
367
+ is-12-hour-clock
368
+ show-toolbar="{{ false }}"
369
+ value="{{ current12Date }}"
370
+ max-hour="{{ maxHour }}"
371
+ min-hour="{{ minHour }}"
372
+ bind:input="onCurrent12DateInput"
373
+ />
374
+ <smart-picker
375
+ class="flex1"
376
+ unit="℃"
377
+ active-index="{{ tempColumnIdx }}"
378
+ columns="{{ tempColumns }}"
379
+ bind:change="onTempColumnChange"
380
+ />
381
+ </view>
382
+ </smart-action-sheet>
383
+ ```
384
+
385
+ ```javascript
386
+ Page({
387
+ data: {
388
+ show: false,
389
+ current12Date: '12:00',
390
+ minHour: 0,
391
+ maxHour: 23,
392
+ tempColumnIdx: 3,
393
+ tempColumns: [39, 40, 41, 42, 43, 44, 45],
394
+ },
395
+
396
+ onClose() {
397
+ this.setData({ show: false });
398
+ },
399
+
400
+ onDoubleSelectorConfirm() {
401
+ console.log('当前双选择器结果', this.data.current12Date, this.data.tempColumnIdx);
402
+ this.setData({
403
+ show: false,
404
+ });
405
+ },
406
+
407
+ onCurrent12DateInput(event) {
408
+ this.setData({
409
+ current12Date: event.detail,
410
+ });
411
+ },
412
+
413
+ onTempColumnChange(event) {
414
+ const { index } = event.detail;
415
+ this.setData({
416
+ tempColumnIdx: index,
417
+ });
418
+ },
419
+ });
420
+ ```
421
+
422
+ ```css
423
+ .demo-custom-double-select-header {
424
+ display: flex;
425
+ align-items: center;
426
+ justify-content: space-around;
427
+ }
428
+
429
+ .demo-custom-double-select-content {
430
+ display: flex;
431
+ align-items: center;
432
+ justify-content: space-between;
433
+ }
434
+
435
+ .flex1 {
436
+ flex: 1;
437
+ }
438
+ ```
439
+
440
+ ## API
441
+
442
+ ### Props
443
+
444
+ | 参数 | 说明 | 类型 | 默认值 |
445
+ | ----------------------- | -------------------------------------------- | --------- | ------------------- |
446
+ | actions | 菜单选项 | _Array_ | `[]` |
447
+ | active-color | 列表选项中 icon 的选中态颜色 | _string_ | `--app-M1` |
448
+ | cancel-text | 取消按钮文字 | _string_ | - |
449
+ | close-on-click-action | 是否在点击选项后关闭 | _boolean_ | `true` |
450
+ | close-on-click-overlay | 点击遮罩是否关闭菜单 | _boolean_ | `true` |
451
+ | confirm-text | 确认按钮文字 | _string_ | - |
452
+ | description | 选项上方的描述信息 | _string_ | - |
453
+ | overlay | 是否显示遮罩层 | _boolean_ | `true` |
454
+ | round | 是否显示圆角 | _boolean_ | `true` |
455
+ | safe-area-inset-bottom | 是否为 iPhoneX 留出底部安全距离 | _boolean_ | `true` |
456
+ | safe-area-inset-bottom-min `v1.1.0` | 是否需要预留出一个最小的底部安全距离,用于在 safeArea 底部为 0 时进行追加,需要在 safeAreaInsetBottom 为 true 时生效 | _number_ | `16` |
457
+ | show | 是否显示动作面板 | _boolean_ | - |
458
+ | title | 标题 | _string_ | - |
459
+ | use-title-slot `v2.6.0` | 是否启用标题 Slot | _boolean_ | `false` |
460
+ | z-index | z-index 层级 | _number_ | `100` |
461
+ | native-disabled `v2.5.0` | 开启弹框期间是否禁用本地手势; 会在弹框开始进入动画时调用 `ty.nativeDisabled(true)`, 在弹框关闭动画结束时调用 `ty.nativeDisabled(false)` 恢复异层组件的点击能力;由于`ty.nativeDisabled` 是全局生效的,所以多个弹框组件同时打开时注意是否传 `native-disabled`属性和关闭的时机,防止 `native-disabled` 属性失效 | _boolean_ | `false` |
462
+ | full-cover-view `v2.11.1` | 是否使用 cover-view 包裹弹层,用于覆盖原生组件(如 map、video)时使用 | _boolean_ | `false` |
463
+
464
+ ### Events
465
+
466
+ | 事件名 | 说明 | 参数 |
467
+ | ------------------ | ---------------------------------------- | ---------------------------- |
468
+ | bind:after-enter | 遮罩进入后触发 | - |
469
+ | bind:after-leave | 遮罩离开后触发 | - |
470
+ | bind:before-enter | 遮罩进入前触发 | - |
471
+ | bind:before-leave | 遮罩离开前触发 | - |
472
+ | bind:cancel | 取消按钮点击时触发 | - |
473
+ | bind:click-overlay | 点击遮罩层时触发 | - |
474
+ | bind:close | 关闭时触发 | - |
475
+ | bind:confirm | 确认按钮点击时触发 | - |
476
+ | bind:enter | 遮罩进入中触发 | - |
477
+ | bind:leave | 遮罩离开中触发 | - |
478
+ | bind:select | 选中选项时触发,禁用或加载状态下不会触发 | event.detail: 选项对应的对象 |
479
+
480
+ ### Slot
481
+
482
+ | 名称 | 说明 |
483
+ | ------- | ---- |
484
+ | default | 自定义面板内容,通常用于插入自定义菜单内容 |
485
+ | title | 自定义标题内容,需要 `use-title-slot` 为 `true`,且未设置 `title` 属性时生效 |
486
+
487
+ ### actions
488
+
489
+ `API`中的`actions`为一个对象数组,数组中的每一个对象配置每一列,每一列有以下`key`:
490
+
491
+ | 键名 | 说明 | 类型 | 默认值 |
492
+ | --------- | ----------------------------- | --------- | ------ |
493
+ | className | 为对应列添加额外的 class 类名 | _string_ | - |
494
+ | color | 选项文字颜色 | _string_ | - |
495
+ | checked | 是否为选中状态,显示选中图标 | _boolean_ | - |
496
+ | disabled | 是否为禁用状态 | _boolean_ | - |
497
+ | loading | 是否为加载状态 | _boolean_ | - |
498
+ | name | 标题 | _string_ | - |
499
+ | subname | 二级标题 | _string_ | - |
500
+
501
+ ### 外部样式类
502
+
503
+ | 类名 | 说明 |
504
+ | ------------ | ------------------- |
505
+ | custom-class | 根节点样式类 |
506
+ | list-class | `actions`容器样式类 |
507
+
508
+
509
+ ### 样式变量
510
+
511
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
512
+
513
+ | 名称 | 默认值 | 描述 |
514
+ | ----------------------------- | -------------------------------------- | ---- |
515
+ | --action-sheet-width | _calc(100% - 32px)_ | 弹窗的宽度 |
516
+ | --action-sheet-left | _16px_ | 弹窗绝对定位左侧的位置 |
517
+ | --action-sheet-max-height | _90%_ | 弹窗的最大高度 |
518
+ | --action-sheet-margin | _0 0 16px_ | 弹窗的边距 |
519
+ | --action-sheet-active-color | _var(--app-B1, #f6f7fb)_ | 选中图标的颜色,以及按下时列表的背景色 |
520
+ | --action-sheet-item-disabled-opacity | _0.3_ | 禁用列表的透明度 |
521
+ | --action-sheet-header-border-color | _var(--app-B4-N7, rgba(0, 0, 0, 0.1))_ | 头部的边框色 |
522
+ | --action-sheet-header-height | _56px_ | 头部的高度 |
523
+ | --action-sheet-header-color | _var(--app-B4-N3, rgba(0, 0, 0, 0.5))_ | 头部的字体颜色 |
524
+ | --action-sheet-header-font-size | _16px_ | 头部的字体大小 |
525
+ | --action-sheet-header-font-weight | _normal_ | 头部的字重 |
526
+ | --action-sheet-description-color | _var(--app-B4-N3, rgba(0, 0, 0, 0.5))_ | 说明文字的颜色 |
527
+ | --action-sheet-description-font-size | _14px_ | 说明文字的字体大小 |
528
+ | --action-sheet-description-line-height | _20px_ | 说明文字的行高 |
529
+ | --action-sheet-item-background | _var(--app-B4, #ffffff)_ | 列表的背景色 |
530
+ | --action-sheet-item-border-radius | _0_ | 列表的边框圆角 |
531
+ | --action-sheet-item-icon-margin | _0px 16px 0 0_ | 列表的图标大小边距 |
532
+ | --action-sheet-item-icon-color | _var(--app-M1, #3678e3)_ | 列表的图标颜色 |
533
+ | --action-sheet-item-icon-size | _28px_ | 列表的图标大小 |
534
+ | --action-sheet-item-font-size | _16px_ | 列表的文字字体大小 |
535
+ | --action-sheet-item-font-weight | _normal_ | 列表的文字字重 |
536
+ | --action-sheet-item-line-height | _24px_ | 列表的文字的行高 |
537
+ | --action-sheet-item-text-color | _var(--app-B4-N1, rgba(0, 0, 0, 1))_ | 列表的文字的颜色 |
538
+ | --action-sheet-subname-color | _var(--app-B4-N3, rgba(0, 0, 0, 0.5))_ | 列表二级名称的字体颜色 |
539
+ | --action-sheet-subname-font-size | _12px_ | 列表二级名称的字体大小 |
540
+ | --action-sheet-subname-line-height | _20px_ | - |
541
+ | --action-sheet-confirm-text-color | _var(--app-B4-N1, rgba(0, 0, 0, 1))_ | 确认按钮的字体颜色 |
542
+ | --action-sheet-confirm-font-weight | _500_ | 确认按钮的字体字重 |
543
+ | --action-sheet-cancel-text-color | _var(--app-B4-N3, rgba(0, 0, 0, 0.5))_ | 取消按钮的字体颜色 |
544
+ | --action-sheet-footer-padding-top | _8px_ | 底部内容的顶部内边距 |
545
+ | --action-sheet-footer-padding-color | _var(--app-B4-N9, rgba(0, 0, 0, 0.05))_ | 底部内容的距离列表的间隔色 |
546
+ | --action-sheet-active-icon-color `v2.2.0` | _var(--app-M1, #3678e3)_ | 列表选中图标的颜色 |
547
+
548
+
549
+
550
+ ## 常见问题
551
+
552
+ ### ActionSheet 子组件使用 Slider 渲染定位异常,是什么情况?
553
+
554
+ 由于 `Slider` 组件在 `ActionSheet` 打开时可能尚未完全渲染,因此我们无法获取其 DOM,从而导致定位出现问题。解决方案是在 `ActionSheet` 的 `onAfterEnter` 事件回调之后再开始渲染 `Slider` 组件。这样,我们可以确保 `Slider` 能够在获取 DOM 时被正常渲染。请参考以下示例:
555
+
556
+ ```html
557
+ <smart-action-sheet
558
+ show="{{ show }}"
559
+ title="Title"
560
+ cancel-text="Action"
561
+ confirm-text="Action"
562
+ bind:close="onClose"
563
+ bind:cancel="onClose"
564
+ bind:confirm="onClose"
565
+ bind:after-enter="onAfterEnter"
566
+ >
567
+ <view class="content-number">
568
+ <view class="demo-header">
569
+ <text class="demo-text">{{ currentNumber }}%</text>
570
+ </view>
571
+ <view class="demo-slider">
572
+ <smart-slider
573
+ wx:if="{{ isReady }}"
574
+ instanceId="action-sheet-slider"
575
+ trackStyle="height:45px;border-radius:8px;"
576
+ barStyle="height:45px;border-radius:8px;"
577
+ thumbStyle="width:15px;height:50px;background:#BBC5D4;border:2px solid #FFFFFF;box-shadow:0px 0px 2px 0px rgba(0, 0, 0, 0.5);border-radius:2px;"
578
+ value="{{ currentNumber }}"
579
+ bind:change="onChange"
580
+ />
581
+ <view wx:else style="height: 45px;" />
582
+ </view>
583
+ </view>
584
+ </smart-action-sheet>
585
+ ```
586
+
587
+ ```javascript
588
+ Page({
589
+ data: {
590
+ show: false,
591
+ isReady: false,
592
+ currentNumber: 0,
593
+ },
594
+
595
+ onClose() {
596
+ this.setData({ show: false });
597
+ },
598
+
599
+ onAfterEnter() {
600
+ this.setData({ isReady: true })
601
+ },
602
+
603
+ onChange(event) {
604
+ this.setData({ currentNumber: event.detail.value });
605
+ },
606
+ });
607
+ ```
608
+
609
+ ```css
610
+ .content-number {
611
+ padding: 10px 39px;
612
+ background: var(--app-B1, #f6f7fb);
613
+ text-align: center;
614
+ color: var(--app-B4-N1, #000);
615
+ }
616
+
617
+ .demo-header {
618
+ padding: 10px 39px;
619
+ }
620
+
621
+ .demo-text {
622
+ font-size: 40px;
623
+ font-weight: 600;
624
+ line-height: 46px;
625
+ }
626
+
627
+ .demo-slider {
628
+ margin: 23px 0;
629
+ min-height: 45px;
630
+ }
631
+ ```