@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.
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,396 @@
1
+ ---
2
+ category: 反馈
3
+ ---
4
+
5
+ # Picker 选择器
6
+
7
+ ### 介绍
8
+
9
+ 提供多个选项集合供用户选择,支持单列选择和多列级联,通常与 [弹出层](/material/smartui?comId=popup&appType=miniapp) 组件配合使用。
10
+
11
+ ### 引入
12
+
13
+ 在`app.json`或`index.json`中引入组件,详细介绍见[快速上手](/material/smartui?comId=help-getting-started&appType=miniapp)。
14
+
15
+ ```json
16
+ "usingComponents": {
17
+ "smart-picker": "@tuya-miniapp/smart-ui/lib/picker/index"
18
+ }
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础用法
24
+
25
+ 单列时 `active-index` 属性可以控制picker的选中项; `change-animation` 可以开启picker的选中值变化过度动画效果。
26
+
27
+ ```html
28
+ <smart-picker
29
+ columns="{{ columns }}"
30
+ active-index="{{3}}"
31
+ change-animation
32
+ bind:change="onChange"
33
+ />
34
+ ```
35
+
36
+ ```javascript
37
+ import Toast from '@tuya-miniapp/smart-ui/toast/toast';
38
+
39
+ Page({
40
+ data: {
41
+ columns: ['杭州', '宁波', '温州', '嘉兴', '湖州'],
42
+ },
43
+
44
+ onChange(event) {
45
+ const { picker, value, index } = event.detail;
46
+ Toast(`当前值:${value}, 当前索引:${index}`);
47
+ },
48
+ });
49
+ ```
50
+
51
+ ### 多列用法
52
+
53
+ `disabled` `v2.3.5` 属性可以禁用此列;`style` 属性可以设置此列的样式;`fontStyle` `v2.3.5` 属性可以设置此列的字体样式; `activeIndex` 可以设置列的选中项。`unitGap` `v2.10.0` 属性可以设置单位和列表的距离。
54
+
55
+ ```html
56
+ <smart-picker active-style="color: #000;" columns="{{ columns }}" bind:change="onChange" />
57
+ ```
58
+
59
+ ```javascript
60
+ import Toast from '@tuya-miniapp/smart-ui/toast/toast';
61
+
62
+ Page({
63
+ data: {
64
+ columns: [
65
+ {
66
+ values: new Array(100).fill(1).map((x, i) => i),
67
+ style: 'flex: none;width: auto;min-width: 61px;',
68
+ fontStyle: 'font-size: 16px;'
69
+ },
70
+ {
71
+ values: ['.'],
72
+ disabled: true,
73
+ style: 'flex: none;width: 8px;display:flex;justify-content: center;'
74
+ },
75
+ {
76
+ values: new Array(20).fill(1).map((x, i) => i),
77
+ style: 'flex: none;width: auto;min-width: 61px;',
78
+ unitGap: '10rpx',
79
+ unit: 'Kg',
80
+ },
81
+ ],
82
+ },
83
+
84
+ onChange(event) {
85
+ const { picker, value, index } = event.detail;
86
+ Toast(`当前值:${value}, 当前索引:${index}`);
87
+ },
88
+ });
89
+ ```
90
+
91
+
92
+ ### 循环列表 `v2.7.0`
93
+
94
+ `loop` 属性可以开启列表的循环渲染,列表会首尾相连,无限循环
95
+
96
+ ```html
97
+
98
+ <smart-picker loop columns="{{ columns }}" bind:change="onChange" />
99
+ ```
100
+
101
+ ```javascript
102
+ import Toast from '@tuya-miniapp/smart-ui/toast/toast';
103
+
104
+ Page({
105
+ data: {
106
+ columns: [
107
+ {
108
+ values: new Array(100).fill(1).map((x, i) => i),
109
+ },
110
+ ],
111
+ },
112
+
113
+ onChange(event) {
114
+ const { picker, value, index } = event.detail;
115
+ Toast(`当前值:${value}, 当前索引:${index}`);
116
+ },
117
+ });
118
+ ```
119
+
120
+ ### 默认选中项
121
+
122
+ 单列选择器可以直接通过`default-index`属性设置初始选中项的索引值。
123
+
124
+ ```html
125
+ <smart-picker
126
+ columns="{{ columns }}"
127
+ default-index="{{ 2 }}"
128
+ bind:change="onChange"
129
+ />
130
+ ```
131
+
132
+ ### 展示顶部栏
133
+
134
+ ```html
135
+ <smart-picker
136
+ show-toolbar
137
+ title="标题"
138
+ columns="{{ columns }}"
139
+ bind:cancel="onCancel"
140
+ bind:confirm="onConfirm"
141
+ />
142
+ ```
143
+
144
+ ```javascript
145
+ import Toast from '@tuya-miniapp/smart-ui/toast/toast';
146
+
147
+ Page({
148
+ data: {
149
+ columns: ['杭州', '宁波', '温州', '嘉兴', '湖州'],
150
+ },
151
+
152
+ onConfirm(event) {
153
+ const { picker, value, index } = event.detail;
154
+ Toast(`当前值:${value}, 当前索引:${index}`);
155
+ },
156
+
157
+ onCancel() {
158
+ Toast('取消');
159
+ },
160
+ });
161
+ ```
162
+
163
+ ### 多列联动
164
+
165
+ ```html
166
+ <smart-picker columns="{{ columns }}" bind:change="onChange" />
167
+ ```
168
+
169
+ ```javascript
170
+ const citys = {
171
+ 浙江: ['杭州', '宁波', '温州', '嘉兴', '湖州'],
172
+ 福建: ['福州', '厦门', '莆田', '三明', '泉州'],
173
+ };
174
+
175
+ Page({
176
+ data: {
177
+ columns: [
178
+ {
179
+ values: Object.keys(citys),
180
+ className: 'column1',
181
+ },
182
+ {
183
+ values: citys['浙江'],
184
+ className: 'column2',
185
+ defaultIndex: 2,
186
+ },
187
+ ],
188
+ },
189
+
190
+ onChange(event) {
191
+ const { picker, value, index } = event.detail;
192
+ picker.setColumnValues(1, citys[value[0]]);
193
+ },
194
+ });
195
+ ```
196
+
197
+ ### 禁用选项
198
+
199
+ 选项可以为对象结构,通过设置 disabled 来禁用该选项。
200
+
201
+ ```html
202
+ <smart-picker columns="{{ columns }}" />
203
+ ```
204
+
205
+ ```javascript
206
+ Page({
207
+ data: {
208
+ columns: [
209
+ { text: '杭州', disabled: true },
210
+ { text: '宁波' },
211
+ { text: '温州' },
212
+ ],
213
+ },
214
+ });
215
+ ```
216
+
217
+ ### 加载状态
218
+
219
+ 当 Picker 数据是通过异步获取时,可以通过 `loading` 属性显示加载提示。
220
+
221
+ ```html
222
+ <smart-picker columns="{{ columns }}" loading />
223
+ ```
224
+
225
+ ### 设置列的样式顺序 `v2.2.0`
226
+
227
+ 通过设置列的 `order` 属性可以设置列的顺序,对应列的order越大,就会越靠后,同css的`flex order` 属性,只是从样式层面改变列的顺序,逻辑还是不变。
228
+
229
+ ```html
230
+ <smart-picker columns="{{ columns }}" />
231
+ ```
232
+
233
+ ```javascript
234
+ Page({
235
+ data: {
236
+ columns: [
237
+ {
238
+ values: ["浙江", "福建"],
239
+ order: 2
240
+ },
241
+ {
242
+ values: ["杭州", "宁波", "温州", "嘉兴", "湖州"],
243
+ order: 1
244
+ },
245
+ ],
246
+ },
247
+ });
248
+ ```
249
+
250
+ ### 更多3D `v2.7.0`
251
+
252
+ `full-height` 属性可以展示更多的空间,看到更多3D翻转的项;当然你也可以覆盖组件的高度样式,来自定义需要可视的空间
253
+
254
+ ```html
255
+
256
+ <smart-picker loop full-height columns="{{ columns }}" bind:change="onChange" />
257
+ ```
258
+
259
+ ```javascript
260
+ import Toast from '@tuya-miniapp/smart-ui/toast/toast';
261
+
262
+ Page({
263
+ data: {
264
+ columns: [
265
+ {
266
+ values: new Array(100).fill(1).map((x, i) => i),
267
+ },
268
+ ],
269
+ },
270
+
271
+ onChange(event) {
272
+ const { picker, value, index } = event.detail;
273
+ Toast(`当前值:${value}, 当前索引:${index}`);
274
+ },
275
+ });
276
+ ```
277
+
278
+ ## API
279
+
280
+ ### Props
281
+
282
+ | 参数 | 说明 | 类型 | 默认值 |
283
+ | ---------------- | -------------------------------- | --------- | ------- |
284
+ | active-index | 单列选择器的当前选中项索引,<br>多列选择器请参考下方的 Columns 配置 | _number_ | `-1` |
285
+ | cancel-button-text | 取消按钮文字 | _string_ | `取消` |
286
+ | columns | 对象数组,配置每一列显示的数据 | _Array_ | `[]` |
287
+ | confirm-button-text | 确认按钮文字 | _string_ | `确认` |
288
+ | default-index | 单列选择器的默认选中项索引,<br>多列选择器请参考下方的 Columns 配置 | _number_ | `0` |
289
+ | item-height | 选项高度 | _number_ | `44` |
290
+ | loading | 是否显示加载状态 | _boolean_ | `false` |
291
+ | show-toolbar | 是否显示顶部栏 | _boolean_ | `false` |
292
+ | title | 顶部栏标题 | _string_ | `''` |
293
+ | toolbar-position | 顶部栏位置,可选值为`bottom` | _string_ | `top` |
294
+ | unit | 单列选择器的默认的单位,<br>多列选择器请参考下方的 Columns 配置 | _number_ | '' |
295
+ | value-key | 选项对象中,文字对应的 key | _string_ | `text` |
296
+ | visible-item-count | 可见的选项个数 | _3 \| 5 \| 7 \| 9_ | `5` |
297
+ | active-style `v2.0.0` | 选中状态下的样式 | _string_ | `''` |
298
+ | change-animation `v2.2.0` | 组件受数据驱动选择值改变时是否需要动画过度效果(不包含手指交互滚动的动画) | _boolean_ | `false` |
299
+ | animation-time `v2.3.7` | 过渡动画以及选择回调延迟的时间(单位ms) | _number_ | `800` `v2.3.7` `300` `v2.6.0` |
300
+ | loop `v2.7.0` | 循环列表 | _boolean_ | `false` |
301
+ | font-style `v2.7.0` | 字体样式,优先级低于 columns 内的 | _string_ | - |
302
+ | full-height `v2.7.0` | 是否高度直接等于 `visibleItemCount * itemHeight`, 组件默认会再 `* 0.9` 缩小最外层可视的高度 | _boolean_ | `false` |
303
+
304
+
305
+ ### Events
306
+
307
+ Picker 组件的事件会根据 columns 是单列或多列返回不同的参数。
308
+
309
+ | 事件名 | 说明 | 参数 |
310
+ | ------------ | ------------------ | ------------------------------------------------------------------------------------------------ |
311
+ | bind:cancel | 点击取消按钮时触发 | 单列:选中值,选中值对应的索引<br>多列:所有列选中值,所有列选中值对应的索引 |
312
+ | bind:change | 选项改变时触发 | 单列:Picker 实例,选中值,选中值对应的索引<br>多列:Picker 实例,所有列选中值,当前列对应的索引 |
313
+ | bind:confirm | 点击完成按钮时触发 | 单列:选中值,选中值对应的索引<br>多列:所有列选中值,所有列选中值对应的索引 |
314
+ | bind:animation-start `v2.3.0` | 组件内部动画开始 | - |
315
+ | bind:animation-end `v2.3.0` | 组件内部动画结束 | - |
316
+
317
+ ### Columns 数据结构
318
+
319
+ 当传入多列数据时,`columns`为一个对象数组,数组中的每一个对象配置每一列,每一列有以下`key`。
320
+
321
+ | key | 说明 |
322
+ | ------------- | --------------------------- |
323
+ | active-index | 当前选中项的索引,默认为 -1 |
324
+ | default-index | 初始选中项的索引,默认为 0 |
325
+ | style `v2.0.0` | 列的样式 |
326
+ | fontStyle `v2.3.5` | 列的文字样式 |
327
+ | unit | 列对应的单位,默认为空 |
328
+ | unitGap `v2.10.0` | 单位和值的间隔,默认为 undefined(使用 CSS 默认样式),支持传入数字(自动添加 px 单位)或字符串(如 "8rpx") | _string \| number_ | `undefined` |
329
+ | values | 列中对应的备选值 |
330
+ | order `v2.2.0` | 设置列的顺序,同`flex order`属性,只是从样式角度修改列的顺序,逻辑还是不变 | _number_ | - |
331
+ | disabled `v2.3.5` | 禁用此列 | _boolean_ | `false` |
332
+ | loop `v2.7.0` | 循环列表 | _boolean_ | `false` |
333
+
334
+ ### 外部样式类
335
+
336
+ | 类名 | 说明 |
337
+ | ------------- | ------------ |
338
+ | column-class | 列样式类 |
339
+ | custom-class | 根节点样式类 |
340
+ | toolbar-class | 顶部栏样式类 |
341
+ | hairline-class `v2.6.0` | 分割线的样式类 |
342
+
343
+
344
+ ### 方法
345
+
346
+ 通过 [selectComponent](/material/smartui?comId=faq&appType=miniapp) 可以获取到 picker 实例并调用实例方法。
347
+
348
+ | 方法名 | 参数 | 返回值 | 介绍 |
349
+ | --------------- | ------------------------ | ----------- | -------------------------- |
350
+ | getColumnIndex | columnIndex | optionIndex | 获取对应列选中项的索引 |
351
+ | getColumnValue | columnIndex | value | 获取对应列选中的值 |
352
+ | getColumnValues | columnIndex | values | 获取对应列中所有选项 |
353
+ | getIndexes | - | indexes | 获取所有列选中值对应的索引 |
354
+ | getValues | - | values | 获取所有列选中的值 |
355
+ | setColumnIndex | columnIndex, optionIndex | - | 设置对应列选中项的索引 |
356
+ | setColumnValue | columnIndex, value | - | 设置对应列选中的值 |
357
+ | setColumnValues | columnIndex, values | - | 设置对应列中所有选项 |
358
+ | setIndexes | indexes | - | 设置所有列选中值对应的索引 |
359
+ | setValues | values | - | 设置所有列选中的值 |
360
+
361
+ ### 样式变量
362
+
363
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
364
+
365
+ | 名称 | 默认值 | 描述 |
366
+ | ----------------------------- | -------------------------------------- | ---- |
367
+ | --picker-background-color | _var(--app-B4, #ffffff)_ | 选择器背景颜色 |
368
+ | --picker-padding | _16px_ | 选择器内边距 |
369
+ | --picker-toolbar-height | _44px_ | 工具栏高度 |
370
+ | --picker-title-font-size | _16px_ | 标题字体大小 |
371
+ | --picker-action-padding | _0 @padding-md_ | 操作按钮内边距 |
372
+ | --picker-action-font-size | _14px_ | 操作按钮字体大小 |
373
+ | --picker-confirm-action-color | _#007AFF_ | 确认按钮颜色 |
374
+ | --picker-cancel-action-color | _#969799_ | 取消按钮颜色 |
375
+ | --picker-option-font-size | _16px_ | 选项字体大小 |
376
+ | --picker-option-unit-font-size | _12px_ | 单位字体大小 |
377
+ | --picker-option-text-color | _var(--app-B6-N1, rgba(0, 0, 0, 1))_ | 选项文本颜色 |
378
+ | --picker-option-unit-text-color | _var(--app-B6-N4, rgba(0, 0, 0, 0.4))_ | 单位文本颜色 |
379
+ | --picker-loading-icon-color | _#1989fa_ | 加载图标颜色 |
380
+ | --picker-loading-mask-color | _var(--app-B4, #ffffff)_ | 加载遮罩颜色 |
381
+ | --picker-option-disabled-opacity | _0.3_ | 禁用选项不透明度 |
382
+ | --picker-option-selected-text-color | _var(--app-B6-N1, rgba(0, 0, 0, 1))_ | 选中选项文本颜色 |
383
+ | --picker-option-unit-mid-size `v2.4.0` | _0_ `v2.4.0` _4px_ `v2.6.0` | 单位和内容文案的间隔 |
384
+ | --picker-option-selected-font-weight-bold `v2.6.0` | _700_ | 选中时文案的字重 |
385
+
386
+ ## 常见问题
387
+
388
+ ### 部分文案无法正常展示
389
+
390
+ 当选项文案中包含双引号 `"` 等特殊字符时,可能导致文案显示不全。需在数据中使用 `\` 转义符自行转义,例如将双引号写为 `\"`,即可正常展示。
391
+
392
+ ```javascript
393
+ // 文案 "--"- 中的双引号需转义
394
+ columns: ['杭州', '宁波', '--"-'] // 可能显示不全
395
+ columns: ['杭州', '宁波', '--\\"-'] // 使用 \ 转义后正常展示
396
+ ```
@@ -0,0 +1,249 @@
1
+ ---
2
+ category: 反馈
3
+ new: true
4
+ version: v2.3.0
5
+ ---
6
+
7
+ # Popover 弹出提示
8
+
9
+ ### 介绍
10
+
11
+ v2.3.0 版本后开始加入,弹出层容器,用于展示弹窗、信息提示等轻量内容。
12
+
13
+ ### 引入
14
+
15
+ 在`app.json`或`index.json`中引入组件,详细介绍见[快速上手](/material/smartui?comId=help-getting-started&appType=miniapp)。
16
+
17
+ ```json
18
+ "usingComponents": {
19
+ "smart-popover": "@tuya-miniapp/smart-ui/lib/popover/index"
20
+ }
21
+ ```
22
+
23
+ ## 代码演示
24
+
25
+ ### 基础用法
26
+
27
+ ```html
28
+ <smart-popover placement="bottomLeft" show="{{show}}" bind:show-change="onShow">
29
+ <smart-button>下左弹出</smart-button>
30
+ <view slot="overlay">
31
+ <smart-cell-group inset>
32
+ <smart-cell
33
+ title="Title"
34
+ >
35
+ <smart-icon
36
+ class="cell-icon"
37
+ slot="icon"
38
+ name="{{ sunMaxFill }}"
39
+ size="24px"
40
+ color="#3678E3"
41
+ />
42
+ </smart-cell>
43
+ <smart-cell
44
+ title="Title"
45
+ border="{{ false }}"
46
+ >
47
+ <smart-icon
48
+ class="cell-icon"
49
+ slot="icon"
50
+ name="{{ sunMaxFill }}"
51
+ size="24px"
52
+ color="#3678E3"
53
+ />
54
+ </smart-cell>
55
+ </smart-cell-group>
56
+ </view>
57
+ </smart-popover>
58
+
59
+ <smart-popover placement="bottom">
60
+ <smart-button>下方弹出</smart-button>
61
+ <view slot="overlay">
62
+ <smart-cell-group inset>
63
+ <smart-cell
64
+ title="Title"
65
+ >
66
+ <smart-icon
67
+ class="cell-icon"
68
+ slot="icon"
69
+ name="{{ sunMaxFill }}"
70
+ size="24px"
71
+ color="#3678E3"
72
+ />
73
+ </smart-cell>
74
+ <smart-cell
75
+ title="Title"
76
+ border="{{ false }}"
77
+ >
78
+ <smart-icon
79
+ class="cell-icon"
80
+ slot="icon"
81
+ name="{{ sunMaxFill }}"
82
+ size="24px"
83
+ color="#3678E3"
84
+ />
85
+ </smart-cell>
86
+ </smart-cell-group>
87
+ </view>
88
+ </smart-popover>
89
+
90
+ <smart-popover placement="bottomRight">
91
+ <smart-button>下右弹出</smart-button>
92
+ <view slot="overlay">
93
+ <smart-cell-group inset>
94
+ <smart-cell
95
+ title="Title"
96
+ >
97
+ <smart-icon
98
+ class="cell-icon"
99
+ slot="icon"
100
+ name="{{ sunMaxFill }}"
101
+ size="24px"
102
+ color="#3678E3"
103
+ />
104
+ </smart-cell>
105
+ <smart-cell
106
+ title="Title"
107
+ border="{{ false }}"
108
+ >
109
+ <smart-icon
110
+ class="cell-icon"
111
+ slot="icon"
112
+ name="{{ sunMaxFill }}"
113
+ size="24px"
114
+ color="#3678E3"
115
+ />
116
+ </smart-cell>
117
+ </smart-cell-group>
118
+ </view>
119
+ </smart-popover>
120
+
121
+ <smart-popover placement="top">
122
+ <smart-button>上方弹出</smart-button>
123
+ <view slot="overlay">
124
+ tip
125
+ </view>
126
+ </smart-popover>
127
+ <smart-popover placement="left">
128
+ <smart-button>左侧弹出</smart-button>
129
+ <view slot="overlay">
130
+ tip
131
+ </view>
132
+ </smart-popover>
133
+ <smart-popover placement="right">
134
+ <smart-button>右侧弹出</smart-button>
135
+ <view slot="overlay">
136
+ tip
137
+ </view>
138
+ </smart-popover>
139
+ <smart-popover placement="bottom">
140
+ <smart-button>下方弹出</smart-button>
141
+ <view slot="overlay">
142
+ tip
143
+ </view>
144
+ </smart-popover>
145
+ ```
146
+
147
+ ```javascript
148
+ import Sun from '@tuya-miniapp/icons/dist/svg/Sun';
149
+
150
+ Page({
151
+ data: {
152
+ show: false,
153
+ sunMaxFill: Sun,
154
+ },
155
+ methods: {
156
+ onShow(e) {
157
+ this.setData({ show: e.detail });
158
+ },
159
+ },
160
+ });
161
+ ```
162
+
163
+ ### 受控用法
164
+
165
+ 通过`show`属性控制弹出层是否展示。
166
+
167
+ ```html
168
+ <smart-popover show="{{show}}" placement="top" bind:close="onClose">
169
+ <smart-button>上方弹出</smart-button>
170
+ <view slot="overlay">
171
+ tip
172
+ </view>
173
+ </smart-popover>
174
+ ```
175
+
176
+ ```js
177
+ Page({
178
+ data: {
179
+ show: false,
180
+ },
181
+ methods: {
182
+ onClose() {
183
+ this.setData({ show: false });
184
+ },
185
+ onShow(e) {
186
+ this.setData({ show: e.detail });
187
+ }
188
+ },
189
+ });
190
+ ```
191
+
192
+ ### 弹出位置
193
+
194
+ 通过`position`属性设置弹出位置,默认居右弹出,可以设置为`top`、`topLeft`、`topRight`、`bottom`、`bottomLeft`、`bottomRight`、`left`、`leftTop`、`leftBottom`、`right`、`rightTop`、`rightBottom`。
195
+
196
+ ```html
197
+ <smart-popover
198
+ show="{{ show }}"
199
+ position="top"
200
+ custom-style="height: 20%;"
201
+ bind:close="onClose"
202
+ bind:show-change=“onShow”
203
+ />
204
+ ```
205
+
206
+ ## API
207
+
208
+ ### Props
209
+ | 参数 | 说明 | 类型 | 默认值 |
210
+ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------- |
211
+ | custom-style | 自定义弹出层样式 | _string_ | `''` |
212
+ | overlay-style `v2.13.1` | 自定义遮罩层样式,透传至内部 `smart-overlay` 的 `custom-style` | _string_ | `''` |
213
+ | duration | 延迟关闭的时间(ms) | number | `3000` |
214
+ | placement | 弹出层的位置,支持值:`top`、`topLeft`、`topRight`、`bottom`、`bottomLeft`、`bottomRight`、`left`、`leftTop`、`leftBottom`、`right`、`rightTop`、`rightBottom` | _string_ | `right` |
215
+ | show | 控制弹出层是否显示,并监听状态变化,值变更时更新 `currentShow` | _boolean_ | `false` |
216
+ | trigger `v2.5.0` | 控制弹出层触发方式,支持 `tap`、`longpress` | _string_ | `tap` |
217
+
218
+ ### Events
219
+
220
+ | 事件名 | 说明 | 参数 |
221
+ | ---------------- | --------------- | ---- |
222
+ | bind:close | 关闭时触发 | - |
223
+ | bind:show-change | 显示/隐藏时触发 | - |
224
+
225
+ ### Popover Slot
226
+
227
+ | 名称 | 说明 |
228
+ | ------- | -------- |
229
+ | overlay | 弹窗内容 |
230
+
231
+ ### 外部样式类
232
+
233
+ | 类名 | 说明 |
234
+ | ------------ | ------------ |
235
+ | custom-class | 根节点样式类 |
236
+
237
+ ### 样式变量
238
+
239
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
240
+
241
+ | 名称 | 默认值 | 描述 |
242
+ | -------------------------------- | ----------------------------------- | ---------------- |
243
+ | --popover-background-color | #fff | 弹出层背景色 |
244
+ | --popover-border-radius | 12px | 弹出层圆角 |
245
+ | --popover-box-shadow | 0px 6px 12px 0px rgba(0, 0, 0, 0.1) | 弹出层阴影 |
246
+ | --popover-overlay-color `v2.8.0` | var(--app-B1-N1, rgba(0, 0, 0, 1)) | 遮照插槽文字颜色 |
247
+ | --popover-padding | 12px | 弹出层内边距 |
248
+
249
+