@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,176 @@
1
+ ---
2
+ category: 数据录入
3
+ ---
4
+
5
+ # Rate 评分
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-rate": "@tuya-miniapp/smart-ui/lib/rate/index"
18
+ }
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础用法
24
+
25
+ ```html
26
+ <smart-rate value="{{ value }}" bind:change="onChange" />
27
+ ```
28
+
29
+ ```javascript
30
+ Page({
31
+ data: {
32
+ value: 3,
33
+ },
34
+
35
+ onChange(event) {
36
+ this.setData({
37
+ value: event.detail,
38
+ });
39
+ },
40
+ });
41
+ ```
42
+
43
+ ### 自定义图标
44
+
45
+ ```html
46
+ <smart-rate
47
+ value="{{ value }}"
48
+ icon="like"
49
+ void-icon="like-o"
50
+ bind:change="onChange"
51
+ />
52
+ ```
53
+
54
+ ### 自定义样式
55
+
56
+ ```html
57
+ <smart-rate
58
+ value="{{ value }}"
59
+ size="{{ 25 }}"
60
+ color="#ffd21e"
61
+ void-icon="star"
62
+ void-color="#eee"
63
+ bind:change="onChange"
64
+ />
65
+ ```
66
+
67
+ ### 半星
68
+
69
+ ```html
70
+ <smart-rate
71
+ value="{{ value }}"
72
+ allow-half
73
+ void-icon="star"
74
+ void-color="#eee"
75
+ bind:change="onChange"
76
+ />
77
+ ```
78
+
79
+ ```javascript
80
+ Page({
81
+ data: {
82
+ value: 2.5,
83
+ },
84
+
85
+ onChange(event) {
86
+ this.setData({
87
+ value: event.detail,
88
+ });
89
+ },
90
+ });
91
+ ```
92
+
93
+ ### 自定义数量
94
+
95
+ ```html
96
+ <smart-rate value="{{ value }}" count="{{ 6 }}" bind:change="onChange" />
97
+ ```
98
+
99
+ ### 禁用状态
100
+
101
+ ```html
102
+ <smart-rate disabled value="{{ value }}" bind:change="onChange" />
103
+ ```
104
+
105
+ ### 只读状态
106
+
107
+ ```html
108
+ <smart-rate readonly value="{{ value }}" bind:change="onChange" />
109
+ ```
110
+
111
+ ### 监听 change 事件
112
+
113
+ 评分变化时,会触发 `change` 事件。
114
+
115
+ ```html
116
+ <smart-rate value="{{ value }}" bind:change="onChange" />
117
+ ```
118
+
119
+ ```javascript
120
+ Page({
121
+ data: {
122
+ value: 2,
123
+ },
124
+
125
+ onChange(event) {
126
+ Toast('当前值:' + event.detail);
127
+ },
128
+ });
129
+ ```
130
+
131
+ ## API
132
+
133
+ ### Props
134
+
135
+ | 参数 | 说明 | 类型 | 默认值 |
136
+ | -------------- | ---------------------------------------------------------- | ------------------ | --------------------- |
137
+ | allow-half | 是否允许半选 | _boolean_ | `false` |
138
+ | color | 选中时的颜色 | _string_ | `#ffd21e` |
139
+ | count | 图标总数 | _number_ | `5` |
140
+ | disabled | 是否禁用评分 | _boolean_ | `false` |
141
+ | disabled-color | 禁用时的颜色 | _string_ | `#bdbdbd` |
142
+ | gutter | 图标间距,默认单位为 `px` | _string \| number_ | `4px` |
143
+ | icon | 选中时的图标svg值或图片链接,可选值见 [Icon 组件](/material/smartui?comId=icon&appType=miniapp) | _string_ | `CheckmarkCircle` |
144
+ | name | 在表单内提交时的标识符 | _string_ | - |
145
+ | readonly | 是否为只读状态 | _boolean_ | `false` |
146
+ | size | 图标大小,默认单位为 `px` | _string \| number_ | `20px` |
147
+ | touchable | 是否可以通过滑动手势选择评分 | _boolean_ | `true` |
148
+ | value | 当前分值 | _number_ | - |
149
+ | void-color | 未选中时的颜色 | _string_ | `#c7c7c7` |
150
+ | void-icon | 未选中时的图标svg值或图片链接,可选值见 [Icon 组件](/material/smartui?comId=icon&appType=miniapp) | _string_ | `CheckmarkCircleVoid` |
151
+
152
+ ### Events
153
+
154
+ | 事件名称 | 说明 | 回调参数 |
155
+ | ----------- | ------------------------ | --------------------- |
156
+ | bind:change | 当前分值变化时触发的事件 | event.detail:当前分值 |
157
+
158
+ ### 外部样式类
159
+
160
+ | 类名 | 说明 |
161
+ | ------------ | ------------ |
162
+ | custom-class | 根节点样式类 |
163
+ | icon-class | 图标样式类 |
164
+
165
+ ### 样式变量
166
+
167
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
168
+
169
+ | 名称 | 默认值 | 描述 |
170
+ | ----------------------------- | -------------------------------------- | ---- |
171
+ | --rate-horizontal-padding | _2px_ | 评价图标水平内边距 |
172
+ | --rate-icon-size | _20px_ | 评价图标大小 |
173
+ | --rate-icon-void-color | _#c8c9cc_ | 空状态图标颜色 |
174
+ | --rate-icon-full-color | _#ee0a24_ | 满状态图标颜色 |
175
+ | --rate-icon-disabled-color | _#c8c9cc_ | 禁用状态图标颜色 |
176
+ | --rate-icon-gutter | _4px_ | 图标间距 |
@@ -0,0 +1,235 @@
1
+ ---
2
+ category: 数据录入
3
+ ---
4
+
5
+ # Search 搜索
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-search": "@tuya-miniapp/smart-ui/lib/search/index"
18
+ }
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础用法
24
+
25
+ `smart-search` 中,value 用于控制搜索框中的文字。
26
+
27
+ ```html
28
+ <smart-search value="{{ value }}" placeholder="请输入搜索关键词" />
29
+ ```
30
+
31
+ ### 简洁风格
32
+
33
+ `smart-search` 中,value 用于控制搜索框中的文字。可以通过 css 变量调整背景。
34
+
35
+ ```css
36
+ .easy-demo {
37
+ --search-background-color: transparent;
38
+ --search-body-background-color: var(--app-B3, #fff);
39
+ }
40
+ ```
41
+
42
+ ```html
43
+ <smart-search
44
+ custom-class="easy-demo"
45
+ model:value="{{ value }}"
46
+ shape="round"
47
+ search-text="搜索"
48
+ placeholder="请输入搜索关键词"
49
+ bind:search="onSearch"
50
+ />
51
+ ```
52
+
53
+ ### 事件监听
54
+
55
+ `smart-search` 提供了 search 和 cancel 事件。search 事件在用户点击键盘上的搜索按钮触发。cancel 事件在用户点击搜索框右侧取消按钮时触发。
56
+
57
+ ```html
58
+ <smart-search
59
+ value="{{ value }}"
60
+ placeholder="请输入搜索关键词"
61
+ show-action
62
+ search-text="搜索"
63
+ action-text="取消"
64
+ bind:search="onSearch"
65
+ bind:cancel="onCancel"
66
+ bind:clear="onClear"
67
+ />
68
+ ```
69
+
70
+ ### 搜索框内容对齐
71
+
72
+ 通过 `input-align` 属性可以设置搜索框内容的对齐方式。
73
+
74
+ ```html
75
+ <smart-search
76
+ value="{{ value }}"
77
+ input-align="center"
78
+ placeholder="请输入搜索关键词"
79
+ />
80
+ ```
81
+
82
+ ### 禁用搜索框
83
+
84
+ 通过 `disabled` 属性可以将组件设置为禁用状态。
85
+
86
+ ```html
87
+ <smart-search disabled value="{{ value }}" placeholder="请输入搜索关键词" />
88
+ ```
89
+
90
+ ### 自定义按钮
91
+
92
+ `smart-search` 支持自定义右侧取消按钮,使用名字为 action 的 slot,并设置 use-action-slot 为 true 即可。
93
+
94
+ ```html
95
+ <smart-search
96
+ value="{{ value }}"
97
+ label="地址"
98
+ shape="round"
99
+ placeholder="请输入搜索关键词"
100
+ use-action-slot
101
+ bind:change="onChange"
102
+ bind:search="onSearch"
103
+ >
104
+ <view slot="action" bind:tap="onClick">搜索</view>
105
+ </smart-search>
106
+
107
+ <smart-search
108
+ value="{{ value }}"
109
+ shape="round"
110
+ placeholder="请输入搜索关键词"
111
+ bind:search="onSearch"
112
+ bind:change="onChange"
113
+ >
114
+ <view slot="search-button" bind:tap="onClick">搜索</view>
115
+ <view slot="label"
116
+ >地址<smart-icon class="icon" name="{{icon}}" size="12px"
117
+ /></view>
118
+ </smart-search>
119
+ ```
120
+
121
+ ```css
122
+ .searchBtn {
123
+ padding: 0 16px;
124
+ }
125
+ .icon {
126
+ margin: 0 8px 0 4px;
127
+ }
128
+ ```
129
+
130
+ ```javascript
131
+ Page({
132
+ data: {
133
+ value: '',
134
+ },
135
+ onChange(e) {
136
+ this.setData({
137
+ value: e.detail,
138
+ });
139
+ },
140
+ onSearch() {
141
+ Toast('搜索' + this.data.value);
142
+ },
143
+ onClick() {
144
+ Toast('搜索' + this.data.value);
145
+ },
146
+ });
147
+ ```
148
+
149
+ ## API
150
+
151
+ ### Props
152
+
153
+ | 参数 | 说明 | 类型 | 默认值 |
154
+ | --- | --- | --- | --- |
155
+ | action-text | 取消按钮文字 | _string_ | `Cancel` |
156
+ | background | 搜索框背景色 | _string_ | `#f2f2f2` |
157
+ | clear-icon | 清除[图标svg字符串](/material/smartui?comId=icon&appType=miniapp)或图片链接 | _string_ | `close` |
158
+ | clear-trigger | 显示清除图标的时机,`always` 表示输入框不为空时展示,<br>`focus` 表示输入框聚焦且不为空时展示 | _string_ | `focus` |
159
+ | clearable | 是否启用清除控件 | _boolean_ | `true` |
160
+ | cursor-spacing | 输入框聚焦时底部与键盘的距离 | _number_ | `0` |
161
+ | disabled | 是否禁用输入框 | _boolean_ | `false` |
162
+ | error | 是否将输入内容标红 | _boolean_ | `false` |
163
+ | focus | 获取焦点 | _boolean_ | `false` |
164
+ | input-align | 输入框内容对齐方式,可选值为 `center` `right` | _string_ | `left` |
165
+ | label | 搜索框左侧文本 | _string_ | - |
166
+ | left-icon | 输入框左侧图标名称或图片链接,可选值见 Icon 组件(如果设置了 use-left-icon-slot,则该属性无效) | _string_ | `search` |
167
+ | maxlength | 最大输入长度,设置为 -1 的时候不限制最大长度 | _number_ | `-1` |
168
+ | name | 在表单内提交时的标识符 | _string_ | - |
169
+ | placeholder | 输入框为空时占位符 | _string_ | - |
170
+ | placeholder-style | 指定占位符的样式 | _string_ | - |
171
+ | readonly | 是否只读 | _boolean_ | `false` |
172
+ | right-icon | 输入框右侧图标名称或图片链接,可选值见 Icon 组件(如果设置了 use-right-icon-slot,则该属性无效) | _string_ | - |
173
+ | shape | 形状,可选值为 `round` | _string_ | `square` |
174
+ | show-action | 是否在搜索框右侧显示取消按钮 | _boolean_ | `false` |
175
+ | use-action-slot | 是否使用 action slot | _boolean_ | `false` |
176
+ | use-left-icon-slot | 是否使用输入框左侧图标 slot | _boolean_ | `false` |
177
+ | use-right-icon-slot | 是否使用输入框右侧图标 slot | _boolean_ | `false` |
178
+ | value | 当前输入的值 | _string \| number_ | - |
179
+ | search-text `v2.0.0` | 搜索按钮文字 | _string_ | - |
180
+
181
+ ### Events
182
+
183
+ | 事件名 | 说明 | 参数 |
184
+ | ---------------- | ------------------ | ------------------------ |
185
+ | bind:blur | 输入框失焦时触发 | - |
186
+ | bind:cancel | 取消搜索搜索时触发 | - |
187
+ | bind:change | 输入内容变化时触发 | event.detail: 当前输入值 |
188
+ | bind:clear | 点击清空控件时触发 | - |
189
+ | bind:click-input | 点击搜索区域时触发 | - |
190
+ | bind:focus | 输入框聚焦时触发 | - |
191
+ | bind:search | 确定搜索时触发 | event.detail: 当前输入值 |
192
+
193
+ ### Slot
194
+
195
+ | 名称 | 说明 |
196
+ | --- | --- |
197
+ | action | 自定义搜索框右侧按钮,需要在`use-action-slot`为 true 时才会显示 |
198
+ | label | 自定义搜索框左侧文本 |
199
+ | left-icon | 自定义输入框左侧图标,需要在`use-left-icon-slot`为 true 时才会显示 |
200
+ | right-icon | 自定义输入框右侧图标,需要在`use-right-icon-slot`为 true 时才会显示 |
201
+ | search-button `v2.0.0` | 自定义搜索按钮 |
202
+
203
+ ### 外部样式类
204
+
205
+ | 类名 | 说明 |
206
+ | ------------ | -------------- |
207
+ | cancel-class | 取消按钮样式类 |
208
+ | custom-class | 根节点样式类 |
209
+ | field-class | 搜索框样式类 |
210
+ | input-class | 输入框样式类 |
211
+
212
+ ### 样式变量
213
+
214
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
215
+
216
+ | 名称 | 默认值 | 描述 |
217
+ | --- | --- | --- |
218
+ | --search-background-color | _var(--app-B3, #fff)_ | 搜索框背景颜色 |
219
+ | --search-body-background-color | _var(--app-B4-N9,rgba(0,0,0,0.05))_ | 搜索内容背景颜色 |
220
+ | --search-padding | _12px var(--padding-md, 16px)_ | 搜索框内边距 |
221
+ | --search-input-height | _24px_ | 输入框高度 |
222
+ | --search-label-padding | _0 5px_ | 标签内边距 |
223
+ | --search-label-color | _var(--app-B4_N1, #000)_ | 标签文本颜色 |
224
+ | --search-label-font-size | _var(--font-size-md)_ | 标签字体大小 |
225
+ | --search-value-font-size | _var(--font-size-md)_ | 输入文字字体大小 |
226
+ | --search-left-icon-color | _var(--app-B4_N4, rgba(0,0,0,0.4))_ | 左侧图标颜色 |
227
+ | --search-action-padding | _0 var(--padding-md) 0 var(--padding-sm)_ | 操作按钮内边距 |
228
+ | --search-action-text-color | _var(--app-B4_N3, rgba(0,0,0,0.5))_ | 操作按钮文本颜色 |
229
+ | --search-action-font-size | _var(--font-size-md)_ | 操作按钮字体大小 |
230
+ | --search-submit-font-size | _var(--font-size-md)_ | 提交按钮字体大小 |
231
+ | --search-submit-color | _var(--app-M1, #3678e3)_ | 提交按钮颜色 |
232
+ | --search-btn-hover-color | _var(--app-B4_N9, rgba(0,0,0,0.05))_ | 按钮悬停颜色 |
233
+ | --search-submit-line-width | _1px_ | 提交按钮线宽度 |
234
+ | --search-submit-line-height | _12px_ | 提交按钮线高度 |
235
+ | --search-btn-hover-opacity | _0.4_ | 按钮悬停透明度 |
@@ -0,0 +1,160 @@
1
+ ---
2
+ category: 导航
3
+ ---
4
+
5
+ # Sidebar 侧边导航
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-sidebar": "@tuya-miniapp/smart-ui/lib/sidebar/index",
18
+ "smart-sidebar-item": "@tuya-miniapp/smart-ui/lib/sidebar-item/index"
19
+ }
20
+ ```
21
+
22
+ ## 代码演示
23
+
24
+ ### 基础用法
25
+
26
+ 通过在`smart-sidebar`上设置`activeKey`属性来控制选中项。
27
+
28
+ ```html
29
+ <smart-sidebar active-key="{{ activeKey }}">
30
+ <smart-sidebar-item title="标签名" />
31
+ <smart-sidebar-item title="标签名" />
32
+ <smart-sidebar-item title="标签名" />
33
+ </smart-sidebar>
34
+ ```
35
+
36
+ ```javascript
37
+ Page({
38
+ data: {
39
+ activeKey: 0,
40
+ },
41
+ });
42
+ ```
43
+
44
+ ### 徽标提示
45
+
46
+ 设置`dot`属性后,会在右上角展示一个小红点。设置`badge`属性后,会在右上角展示相应的徽标。
47
+
48
+ ```html
49
+ <smart-sidebar active-key="{{ activeKey }}">
50
+ <smart-sidebar-item title="标签名" dot />
51
+ <smart-sidebar-item title="标签名" badge="5" />
52
+ <smart-sidebar-item title="标签名" badge="99+" />
53
+ </smart-sidebar>
54
+ ```
55
+
56
+ ### 禁用选项
57
+
58
+ 通过`disabled`属性禁用选项。
59
+
60
+ ```html
61
+ <smart-sidebar active-key="{{ activeKey }}">
62
+ <smart-sidebar-item title="标签名" />
63
+ <smart-sidebar-item title="标签名" disabled />
64
+ <smart-sidebar-item title="标签名" />
65
+ </smart-sidebar>
66
+ ```
67
+
68
+ ### 监听切换事件
69
+
70
+ 设置`change`方法来监听切换导航项时的事件。
71
+
72
+ ```html
73
+ <smart-sidebar active-key="{{ activeKey }}" bind:change="onChange">
74
+ <smart-sidebar-item title="标签名 1" />
75
+ <smart-sidebar-item title="标签名 2" />
76
+ <smart-sidebar-item title="标签名 3" />
77
+ </smart-sidebar>
78
+
79
+ <smart-notify id="smart-notify" />
80
+ ```
81
+
82
+ ```js
83
+ import Notify from '@tuya-miniapp/smart-ui/notify/notify';
84
+
85
+ Page({
86
+ data: {
87
+ activeKey: 0,
88
+ },
89
+
90
+ onChange(event) {
91
+ Notify({ type: 'primary', message: event.detail });
92
+ },
93
+ });
94
+ ```
95
+
96
+ ## API
97
+
98
+ ### Sidebar Props
99
+
100
+ | 参数 | 说明 | 类型 | 默认值 |
101
+ | --------- | ------------ | ------------------ | ------ |
102
+ | activeKey | 选中项的索引 | _string \| number_ | `0` |
103
+
104
+ ### Sidebar Event
105
+
106
+ | 事件名 | 说明 | 参数 |
107
+ | ------ | -------------- | ------------------ |
108
+ | change | 切换徽章时触发 | 当前选中徽章的索引 |
109
+
110
+ ### Sidebar 外部样式类
111
+
112
+ | 类名 | 说明 |
113
+ | ------------ | ------------ |
114
+ | custom-class | 根节点样式类 |
115
+
116
+ ### SidebarItem Props
117
+
118
+ | 参数 | 说明 | 类型 | 默认值 |
119
+ | ----- | -------------------- | --------- | ------- |
120
+ | dot | 是否显示右上角小红点 | _boolean_ | `false` |
121
+ | title | 内容 | _string_ | `''` |
122
+ | badge | 图标右上角徽标的内容 | _string \| number_ | `''` |
123
+ | disabled | 是否禁用该项 | _boolean_ | `false` |
124
+
125
+ ### SidebarItem Slot
126
+
127
+ | 名称 | 说明 |
128
+ | ----- | ------------------------------------------- |
129
+ | title | 自定义标题栏,如果设置了`title`属性则不生效 |
130
+
131
+ ### SidebarItem Event
132
+
133
+ | 事件名 | 说明 | 参数 |
134
+ | ------ | -------------- | ------------------------------- |
135
+ | click | 点击徽章时触发 | `event.detail` 为当前徽章的索引 |
136
+
137
+ ### SidebarItem 外部样式类
138
+
139
+ | 类名 | 说明 |
140
+ | ------------ | ------------ |
141
+ | custom-class | 根节点样式类 |
142
+
143
+ ### 样式变量
144
+
145
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
146
+
147
+ | 名称 | 默认值 | 描述 |
148
+ | ----------------------------- | -------------------------------------- | ---- |
149
+ | --sidebar-width | _80px_ | 侧边栏宽度 |
150
+ | --sidebar-font-size | _14px_ | 侧边栏字体大小 |
151
+ | --sidebar-line-height | _20px_ | 侧边栏行高 |
152
+ | --sidebar-text-color | _var(--app-B6-N1, rgba(0, 0, 0, 1))_ | 侧边栏文本颜色 |
153
+ | --sidebar-disabled-text-color | _var(--app-B6-N5, rgba(0, 0, 0, 0.3))_ | 禁用状态文本颜色 |
154
+ | --sidebar-padding | _20px @padding-sm 20px @padding-xs_ | 侧边栏内边距 |
155
+ | --sidebar-active-color | _var(--app-B6, #fff)_ | 活动状态颜色 |
156
+ | --sidebar-background-color | _var(--app-B1, #f6f7fb)_ | 侧边栏背景颜色 |
157
+ | --sidebar-selected-font-weight| _500_ | 选中状态字体粗细 |
158
+ | --sidebar-selected-text-color | _var(--app-B6-N1, rgba(0, 0, 0, 1))_ | 选中状态文本颜色 |
159
+ | --sidebar-selected-border-color| _#ee0a24_ | 选中状态边框颜色 |
160
+ | --sidebar-selected-background-color| _var(--app-B6, #fff)_ | 选中状态背景颜色 |
@@ -0,0 +1,98 @@
1
+ ---
2
+ category: 展示
3
+ ---
4
+
5
+ # Skeleton 骨架屏
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-skeleton": "@tuya-miniapp/smart-ui/lib/skeleton/index"
18
+ }
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础用法
24
+
25
+ 通过`title`属性显示标题占位图,通过`row`属性配置占位段落行数。
26
+
27
+ ```html
28
+ <smart-skeleton title row="3" />
29
+ ```
30
+
31
+ ### 显示头像
32
+
33
+ 通过`avatar`属性显示头像占位图。
34
+
35
+ ```html
36
+ <smart-skeleton title avatar row="3" />
37
+ ```
38
+
39
+ ### 展示子组件
40
+
41
+ 将`loading`属性设置成`false`表示内容加载完成,此时会隐藏占位图,并显示`Skeleton`的子组件。
42
+
43
+ ```html
44
+ <smart-skeleton title avatar row="3" loading="{{ loading }}">
45
+ <view>实际内容</view>
46
+ </smart-skeleton>
47
+ ```
48
+
49
+ ```js
50
+ Page({
51
+ data: {
52
+ loading: true,
53
+ },
54
+ onReady() {
55
+ this.setData({
56
+ loading: false,
57
+ });
58
+ },
59
+ });
60
+ ```
61
+
62
+ ## API
63
+
64
+ ### Props
65
+
66
+ | 参数 | 说明 | 类型 | 默认值 |
67
+ | ------------ | ------------------------------------------- | -------------------- | ------- |
68
+ | animate | 是否开启动画 | _boolean_ | `true` |
69
+ | avatar | 是否显示头像占位图 | _boolean_ | `false` |
70
+ | avatar-shape | 头像占位图形状,可选值为`square` | _string_ | `round` |
71
+ | avatar-size | 头像占位图大小 | _string \| number_ | `32px` |
72
+ | loading | 是否显示占位图,传`false`时会展示子组件内容 | _boolean_ | `true` |
73
+ | row | 段落占位图行数 | _number_ | `0` |
74
+ | row-width | 段落占位图宽度,可传数组来设置每一行的宽度 | _string \| string[]_ | `100%` |
75
+ | title | 是否显示标题占位图 | _boolean_ | `false` |
76
+ | title-width | 标题占位图宽度 | _string \| number_ | `40%` |
77
+
78
+ ### 外部样式类
79
+
80
+ | 类名 | 说明 |
81
+ | ------------ | -------------- |
82
+ | avatar-class | 头像占位样式类 |
83
+ | custom-class | 根节点样式类 |
84
+ | row-class | 段落占位样式类 |
85
+ | title-class | 标题占位样式类 |
86
+
87
+ ### 样式变量
88
+
89
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
90
+
91
+ | 名称 | 默认值 | 描述 |
92
+ | ----------------------------- | -------------------------------------- | ---- |
93
+ | --skeleton-padding | _0 @padding-md_ | 骨架屏内边距 |
94
+ | --skeleton-row-height | _16px_ | 骨架屏行高 |
95
+ | --skeleton-row-background-color | _var(--app-B3, #ffffff)_ | 骨架屏行背景颜色 |
96
+ | --skeleton-row-margin-top | _12px_ | 骨架屏行上边距 |
97
+ | --skeleton-avatar-background-color | _var(--app-B3, #ffffff)_ | 骨架屏头像背景颜色 |
98
+ | --skeleton-animation-duration | _1.2s_ | 动画持续时间 |