stellar-ui-plus 1.25.1 → 1.25.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 (247) hide show
  1. package/components/ste-animate/ATTRIBUTES.md +13 -5
  2. package/components/ste-animate/README.md +4 -28
  3. package/components/ste-animate/ste-animate.easycom.json +31 -9
  4. package/components/ste-app-update/ATTRIBUTES.md +11 -5
  5. package/components/ste-app-update/README.md +1 -3
  6. package/components/ste-app-update/method.ts +44 -1
  7. package/components/ste-app-update/props.ts +17 -2
  8. package/components/ste-app-update/ste-app-update.easycom.json +18 -8
  9. package/components/ste-app-update/ste-app-update.vue +93 -18
  10. package/components/ste-area-chart/ATTRIBUTES.md +3 -1
  11. package/components/ste-area-chart/README.md +4 -4
  12. package/components/ste-badge/ATTRIBUTES.md +10 -1
  13. package/components/ste-badge/README.md +9 -18
  14. package/components/ste-badge/ste-badge.easycom.json +8 -0
  15. package/components/ste-bar-chart/ATTRIBUTES.md +3 -1
  16. package/components/ste-bar-chart/README.md +3 -5
  17. package/components/ste-barcode/ATTRIBUTES.md +6 -2
  18. package/components/ste-barcode/README.md +3 -5
  19. package/components/ste-barcode/ste-barcode.easycom.json +1 -2
  20. package/components/ste-button/ATTRIBUTES.md +24 -14
  21. package/components/ste-button/README.md +11 -19
  22. package/components/ste-button/ste-button.easycom.json +76 -12
  23. package/components/ste-calendar/ATTRIBUTES.md +12 -2
  24. package/components/ste-calendar/README.md +16 -24
  25. package/components/ste-calendar/ste-calendar.easycom.json +4 -3
  26. package/components/ste-category/ATTRIBUTES.md +6 -2
  27. package/components/ste-category/README.md +2 -4
  28. package/components/ste-category/ste-category.easycom.json +1 -2
  29. package/components/ste-checkbox/ATTRIBUTES.md +6 -2
  30. package/components/ste-checkbox/README.md +18 -20
  31. package/components/ste-checkbox/ste-checkbox.easycom.json +1 -3
  32. package/components/ste-checkbox/ste-checkbox.vue +71 -80
  33. package/components/ste-code-input/ATTRIBUTES.md +8 -4
  34. package/components/ste-code-input/README.md +7 -9
  35. package/components/ste-code-input/ste-code-input.easycom.json +13 -4
  36. package/components/ste-column-chart/ATTRIBUTES.md +3 -1
  37. package/components/ste-column-chart/README.md +5 -7
  38. package/components/ste-comment/ATTRIBUTES.md +3 -1
  39. package/components/ste-comment/README.md +2 -4
  40. package/components/ste-coupon-list/ATTRIBUTES.md +15 -5
  41. package/components/ste-coupon-list/README.md +6 -14
  42. package/components/ste-coupon-list/ste-coupon-list.easycom.json +22 -3
  43. package/components/ste-custom-keyboard/ATTRIBUTES.md +16 -7
  44. package/components/ste-custom-keyboard/README.md +10 -18
  45. package/components/ste-custom-keyboard/ste-custom-keyboard.easycom.json +28 -10
  46. package/components/ste-date-picker/ATTRIBUTES.md +9 -5
  47. package/components/ste-date-picker/README.md +9 -11
  48. package/components/ste-date-picker/ste-date-picker.easycom.json +19 -4
  49. package/components/ste-date-user/ATTRIBUTES.md +9 -1
  50. package/components/ste-date-user/README.md +3 -11
  51. package/components/ste-date-user/ste-date-user.easycom.json +4 -0
  52. package/components/ste-drag/ATTRIBUTES.md +13 -3
  53. package/components/ste-drag/README.md +5 -13
  54. package/components/ste-drag/ste-drag.easycom.json +10 -2
  55. package/components/ste-drag-sort/ATTRIBUTES.md +25 -0
  56. package/components/ste-drag-sort/README.md +116 -0
  57. package/components/ste-drag-sort/config.json +5 -0
  58. package/components/ste-drag-sort/props.ts +16 -0
  59. package/components/ste-drag-sort/ste-drag-sort.easycom.json +88 -0
  60. package/components/ste-drag-sort/ste-drag-sort.vue +589 -0
  61. package/components/ste-dropdown-menu/ATTRIBUTES.md +8 -4
  62. package/components/ste-dropdown-menu/README.md +14 -16
  63. package/components/ste-dropdown-menu/ste-dropdown-menu.easycom.json +13 -4
  64. package/components/ste-filter-tool/ATTRIBUTES.md +6 -2
  65. package/components/ste-filter-tool/README.md +4 -6
  66. package/components/ste-filter-tool/ste-filter-tool.easycom.json +1 -5
  67. package/components/ste-function-list/ATTRIBUTES.md +13 -2
  68. package/components/ste-function-list/README.md +3 -12
  69. package/components/ste-function-list/ste-function-list.easycom.json +8 -3
  70. package/components/ste-funnel-chart/ATTRIBUTES.md +3 -1
  71. package/components/ste-funnel-chart/README.md +4 -6
  72. package/components/ste-goods-info/ATTRIBUTES.md +15 -4
  73. package/components/ste-goods-info/README.md +8 -17
  74. package/components/ste-goods-info/ste-goods-info.easycom.json +40 -13
  75. package/components/ste-goods-list/ATTRIBUTES.md +9 -1
  76. package/components/ste-goods-list/README.md +4 -12
  77. package/components/ste-goods-list/ste-goods-list.easycom.json +4 -0
  78. package/components/ste-guide-qa/ATTRIBUTES.md +15 -4
  79. package/components/ste-guide-qa/README.md +6 -15
  80. package/components/ste-guide-qa/ste-guide-qa.easycom.json +20 -2
  81. package/components/ste-icon/ATTRIBUTES.md +7 -3
  82. package/components/ste-icon/README.md +5 -7
  83. package/components/ste-icon/ste-icon.easycom.json +7 -2
  84. package/components/ste-image/ATTRIBUTES.md +13 -2
  85. package/components/ste-image/README.md +6 -15
  86. package/components/ste-image/ste-image.easycom.json +8 -3
  87. package/components/ste-index-list/ATTRIBUTES.md +8 -4
  88. package/components/ste-index-list/README.md +6 -8
  89. package/components/ste-index-list/ste-index-list.easycom.json +13 -3
  90. package/components/ste-input/ATTRIBUTES.md +14 -3
  91. package/components/ste-input/README.md +16 -25
  92. package/components/ste-input/ste-input.easycom.json +14 -5
  93. package/components/ste-line-chart/ATTRIBUTES.md +3 -1
  94. package/components/ste-line-chart/README.md +5 -7
  95. package/components/ste-loading/ATTRIBUTES.md +3 -1
  96. package/components/ste-loading/README.md +6 -8
  97. package/components/ste-login/ATTRIBUTES.md +12 -2
  98. package/components/ste-login/README.md +7 -15
  99. package/components/ste-login/ste-login.easycom.json +4 -7
  100. package/components/ste-login-info/ATTRIBUTES.md +6 -2
  101. package/components/ste-login-info/README.md +2 -4
  102. package/components/ste-login-info/ste-login-info.easycom.json +1 -4
  103. package/components/ste-marquee/ATTRIBUTES.md +44 -0
  104. package/components/ste-marquee/README.md +123 -0
  105. package/components/ste-marquee/config.json +5 -0
  106. package/components/ste-marquee/props.ts +106 -0
  107. package/components/ste-marquee/ste-marquee.easycom.json +132 -0
  108. package/components/ste-marquee/ste-marquee.vue +249 -0
  109. package/components/ste-media-preview/ATTRIBUTES.md +14 -4
  110. package/components/ste-media-preview/README.md +23 -32
  111. package/components/ste-media-preview/ste-media-preview.easycom.json +16 -4
  112. package/components/ste-message-box/ATTRIBUTES.md +3 -1
  113. package/components/ste-message-box/README.md +11 -13
  114. package/components/ste-navbar/ATTRIBUTES.md +13 -3
  115. package/components/ste-navbar/README.md +5 -13
  116. package/components/ste-navbar/ste-navbar.easycom.json +10 -1
  117. package/components/ste-notice-bar/ATTRIBUTES.md +16 -5
  118. package/components/ste-notice-bar/README.md +11 -20
  119. package/components/ste-notice-bar/ste-notice-bar.easycom.json +26 -3
  120. package/components/ste-number-keyboard/ATTRIBUTES.md +17 -7
  121. package/components/ste-number-keyboard/README.md +9 -18
  122. package/components/ste-number-keyboard/ste-number-keyboard.easycom.json +32 -9
  123. package/components/ste-order-card/ATTRIBUTES.md +6 -2
  124. package/components/ste-order-card/README.md +4 -6
  125. package/components/ste-order-card/ste-order-card.easycom.json +1 -4
  126. package/components/ste-pie-chart/ATTRIBUTES.md +3 -1
  127. package/components/ste-pie-chart/README.md +4 -6
  128. package/components/ste-popup/ATTRIBUTES.md +15 -5
  129. package/components/ste-popup/README.md +10 -18
  130. package/components/ste-popup/ste-popup.easycom.json +22 -4
  131. package/components/ste-price/ATTRIBUTES.md +7 -3
  132. package/components/ste-price/README.md +10 -12
  133. package/components/ste-price/ste-price.easycom.json +7 -2
  134. package/components/ste-progress/ATTRIBUTES.md +9 -1
  135. package/components/ste-progress/README.md +9 -17
  136. package/components/ste-progress/ste-progress.easycom.json +4 -0
  137. package/components/ste-qrcode/ATTRIBUTES.md +6 -2
  138. package/components/ste-qrcode/README.md +4 -6
  139. package/components/ste-qrcode/ste-qrcode.easycom.json +1 -2
  140. package/components/ste-radio/ATTRIBUTES.md +6 -2
  141. package/components/ste-radio/README.md +17 -19
  142. package/components/ste-radio/ste-radio.easycom.json +1 -3
  143. package/components/ste-radio/ste-radio.vue +109 -85
  144. package/components/ste-rate/ATTRIBUTES.md +7 -3
  145. package/components/ste-rate/README.md +8 -10
  146. package/components/ste-rate/ste-rate.easycom.json +7 -2
  147. package/components/ste-read-more/ATTRIBUTES.md +20 -4
  148. package/components/ste-read-more/README.md +5 -19
  149. package/components/ste-read-more/ste-read-more.easycom.json +20 -2
  150. package/components/ste-rich-text/ATTRIBUTES.md +3 -1
  151. package/components/ste-rich-text/README.md +2 -4
  152. package/components/ste-ring-chart/ATTRIBUTES.md +3 -1
  153. package/components/ste-ring-chart/README.md +22 -5
  154. package/components/ste-ring-chart/ste-ring-chart.vue +40 -1
  155. package/components/ste-scroll-to/ATTRIBUTES.md +7 -3
  156. package/components/ste-scroll-to/README.md +2 -4
  157. package/components/ste-scroll-to/ste-scroll-to.easycom.json +7 -2
  158. package/components/ste-search/ATTRIBUTES.md +14 -3
  159. package/components/ste-search/README.md +12 -21
  160. package/components/ste-search/ste-search.easycom.json +14 -7
  161. package/components/ste-search-box/ATTRIBUTES.md +6 -2
  162. package/components/ste-search-box/README.md +3 -5
  163. package/components/ste-search-box/ste-search-box.easycom.json +1 -3
  164. package/components/ste-select/ATTRIBUTES.md +9 -5
  165. package/components/ste-select/README.md +11 -11
  166. package/components/ste-select/ste-select.easycom.json +19 -6
  167. package/components/ste-select-seat/ATTRIBUTES.md +8 -4
  168. package/components/ste-select-seat/README.md +7 -21
  169. package/components/ste-select-seat/ste-select-seat.easycom.json +13 -3
  170. package/components/ste-signature/ATTRIBUTES.md +18 -5
  171. package/components/ste-signature/README.md +3 -14
  172. package/components/ste-signature/ste-signature.easycom.json +50 -3
  173. package/components/ste-simple-calendar/ATTRIBUTES.md +16 -4
  174. package/components/ste-simple-calendar/README.md +8 -18
  175. package/components/ste-simple-calendar/ste-simple-calendar.easycom.json +30 -2
  176. package/components/ste-skeleton/ATTRIBUTES.md +9 -1
  177. package/components/ste-skeleton/README.md +5 -13
  178. package/components/ste-skeleton/ste-skeleton.easycom.json +4 -0
  179. package/components/ste-slide-verify/ATTRIBUTES.md +16 -5
  180. package/components/ste-slide-verify/README.md +7 -16
  181. package/components/ste-slide-verify/ste-slide-verify.easycom.json +26 -3
  182. package/components/ste-slider/ATTRIBUTES.md +14 -2
  183. package/components/ste-slider/README.md +11 -21
  184. package/components/ste-slider/ste-slider.easycom.json +12 -4
  185. package/components/ste-stepper/ATTRIBUTES.md +9 -5
  186. package/components/ste-stepper/README.md +9 -13
  187. package/components/ste-stepper/ste-stepper.easycom.json +19 -6
  188. package/components/ste-steps/ATTRIBUTES.md +6 -2
  189. package/components/ste-steps/README.md +9 -11
  190. package/components/ste-steps/ste-steps.easycom.json +1 -2
  191. package/components/ste-sticky/ATTRIBUTES.md +8 -4
  192. package/components/ste-sticky/README.md +2 -4
  193. package/components/ste-sticky/ste-sticky.easycom.json +13 -3
  194. package/components/ste-swipe-action/ATTRIBUTES.md +14 -3
  195. package/components/ste-swipe-action/README.md +9 -18
  196. package/components/ste-swipe-action/ste-swipe-action.easycom.json +20 -2
  197. package/components/ste-swipe-action/useData.ts +15 -8
  198. package/components/ste-swipe-action-group/ATTRIBUTES.md +6 -2
  199. package/components/ste-swipe-action-group/ste-swipe-action-group.easycom.json +1 -3
  200. package/components/ste-swiper/ATTRIBUTES.md +6 -2
  201. package/components/ste-swiper/README.md +12 -14
  202. package/components/ste-swiper/ste-swiper.easycom.json +1 -3
  203. package/components/ste-switch/ATTRIBUTES.md +8 -4
  204. package/components/ste-switch/README.md +7 -9
  205. package/components/ste-switch/ste-switch.easycom.json +13 -3
  206. package/components/ste-tab/ATTRIBUTES.md +3 -1
  207. package/components/ste-table/ATTRIBUTES.md +12 -8
  208. package/components/ste-table/README.md +23 -23
  209. package/components/ste-table/ste-table.easycom.json +38 -9
  210. package/components/ste-tabs/ATTRIBUTES.md +9 -4
  211. package/components/ste-tabs/README.md +4 -6
  212. package/components/ste-tabs/props.ts +3 -0
  213. package/components/ste-tabs/ste-tabs.easycom.json +18 -2
  214. package/components/ste-tabs/useData.ts +1 -1
  215. package/components/ste-text/ATTRIBUTES.md +9 -1
  216. package/components/ste-text/README.md +4 -12
  217. package/components/ste-text/ste-text.easycom.json +4 -0
  218. package/components/ste-toast/ATTRIBUTES.md +10 -1
  219. package/components/ste-toast/README.md +9 -18
  220. package/components/ste-toast/ste-toast.easycom.json +14 -0
  221. package/components/ste-touch-swipe/ATTRIBUTES.md +6 -2
  222. package/components/ste-touch-swipe/README.md +4 -6
  223. package/components/ste-touch-swipe/ste-touch-swipe.easycom.json +1 -2
  224. package/components/ste-tour/ATTRIBUTES.md +7 -3
  225. package/components/ste-tour/README.md +5 -7
  226. package/components/ste-tour/ste-tour.easycom.json +11 -4
  227. package/components/ste-tree/ATTRIBUTES.md +15 -2
  228. package/components/ste-tree/README.md +6 -17
  229. package/components/ste-tree/ste-tree.easycom.json +16 -4
  230. package/components/ste-upload/ATTRIBUTES.md +17 -5
  231. package/components/ste-upload/README.md +9 -20
  232. package/components/ste-upload/ste-upload.easycom.json +36 -9
  233. package/components/ste-user-info/ATTRIBUTES.md +15 -5
  234. package/components/ste-user-info/README.md +5 -13
  235. package/components/ste-user-info/ste-user-info.easycom.json +22 -4
  236. package/components/ste-video/ATTRIBUTES.md +3 -1
  237. package/components/ste-video/README.md +4 -8
  238. package/components/ste-watermark/ATTRIBUTES.md +3 -1
  239. package/components/ste-watermark/README.md +5 -7
  240. package/config/font-size.ts +3 -0
  241. package/config/index.ts +5 -0
  242. package/index.ts +4 -0
  243. package/package.json +1 -1
  244. package/types/components.d.ts +4 -0
  245. package/types/refComponents.d.ts +4 -0
  246. package/utils/System.ts +50 -15
  247. package/utils/mixin.ts +4 -3
@@ -6,9 +6,9 @@
6
6
 
7
7
  - 由于性能不如原生组件,若数据量较多时推荐使用虚拟列表的形式渲染或者直接使用原生组件
8
8
 
9
- ### 代码演示
9
+ ## 代码演示
10
10
 
11
- #### 基础用法
11
+ ## 基础用法
12
12
 
13
13
  单一的checkbox中,默认绑定变量的值会是Boolean,选中为true
14
14
 
@@ -22,7 +22,7 @@
22
22
  </template>
23
23
  ```
24
24
 
25
- #### 禁用
25
+ ## 禁用
26
26
 
27
27
  通过设置 `disabled` 属性可以禁用复选框, 默认`false`。
28
28
 
@@ -38,7 +38,7 @@
38
38
  </template>
39
39
  ```
40
40
 
41
- #### 只读
41
+ ## 只读
42
42
 
43
43
  通过设置 `readonly` 属性可以禁用复选框,样式不置灰, 默认`false`。
44
44
 
@@ -54,7 +54,7 @@
54
54
  </template>
55
55
  ```
56
56
 
57
- #### 自定义形状
57
+ ## 自定义形状
58
58
 
59
59
  通过设置`shape`为`square`或者`circle`,将复选框设置为方形或者圆形,默认`circle`。
60
60
 
@@ -70,7 +70,7 @@
70
70
  </template>
71
71
  ```
72
72
 
73
- #### 自定义图标大小
73
+ ## 自定义图标大小
74
74
 
75
75
  通过设置 `iconSize` 属性可以自定义图标的大小,单位`rpx`,默认`36`。
76
76
 
@@ -84,7 +84,7 @@
84
84
  </template>
85
85
  ```
86
86
 
87
- #### 自定义图标颜色
87
+ ## 自定义图标颜色
88
88
 
89
89
  通过设置 `checkedColor` 属性可以自定义图标的颜色(填充色和边框色),默认`#0090FF`。
90
90
 
@@ -98,7 +98,7 @@
98
98
  </template>
99
99
  ```
100
100
 
101
- #### 自定义图标
101
+ ## 自定义图标
102
102
 
103
103
  通过 `icon` 插槽自定义图标,可以通过 `slotProps`下`checked`判断是否为选中状态,`disabled`判断是否为禁止状态,`readonly`判断是否为只读状态。
104
104
 
@@ -137,7 +137,7 @@
137
137
  </template>
138
138
  ```
139
139
 
140
- #### 左侧文本
140
+ ## 左侧文本
141
141
 
142
142
  将 `textPosition` 属性设置为 `left`,可以将文本位置调整到复选框左侧。
143
143
 
@@ -153,7 +153,7 @@
153
153
  </template>
154
154
  ```
155
155
 
156
- #### 自定义文本
156
+ ## 自定义文本
157
157
 
158
158
  - 通过设置 `textSize` 属性可以自定义文本的大小,单位`rpx`,默认`28`。
159
159
  - 通过设置 `textInactiveColor` 属性可以自定义文本未选中颜色,默认`#000000`。
@@ -169,7 +169,7 @@
169
169
  </template>
170
170
  ```
171
171
 
172
- #### 回调事件
172
+ ## 回调事件
173
173
 
174
174
  - `click` 点击复选框时触发的事件(可拦截change事件),`value`:改变后的分值,`allowStop`:允许阻止后续的事件触发,:`resolve`:后续的事件执行。
175
175
  - `change` 当绑定值变化时触发的事件,`value`:改变后的分值。
@@ -211,7 +211,7 @@
211
211
  </template>
212
212
  ```
213
213
 
214
- ### 复选框组
214
+ ## 复选框组
215
215
 
216
216
  需要与`ste-checkbox-group`一起使用,选中值是一个数组,通过`value`绑定在`ste-checkbox-group`上,数组中的项即为选中的`ste-checkbox`的`name`属性设置的值。
217
217
 
@@ -229,7 +229,7 @@
229
229
  </template>
230
230
  ```
231
231
 
232
- ### 复选框组属性和复选框属性
232
+ ## 复选框组属性和复选框属性
233
233
 
234
234
  属性优先级:`ste-checkbox`组件上配置的属性 > `ste-checkbox-group`组件上配置的属性 > `ste-checkbox`组件默认属性
235
235
 
@@ -247,7 +247,7 @@
247
247
  </template>
248
248
  ```
249
249
 
250
- ### 水平排列
250
+ ## 水平排列
251
251
 
252
252
  将 `direction` 属性设置为 `row` 后,复选框组会变成水平排列。
253
253
 
@@ -265,7 +265,7 @@
265
265
  </template>
266
266
  ```
267
267
 
268
- ### 限制最大可选数
268
+ ## 限制最大可选数
269
269
 
270
270
  通过 `max` 属性可以限制复选框组的最大可选数,为`0`则不限制,默认0。
271
271
 
@@ -285,11 +285,9 @@
285
285
 
286
286
  ---$
287
287
 
288
- ### API
289
-
290
288
  <!-- props -->
291
289
 
292
- #### CheckboxGroup 组件属性(Props)
290
+ ## CheckboxGroup 组件属性(Props)
293
291
 
294
292
  | 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
295
293
  | ------------------- | --------------------------------- | --------------- | --------- | --------------------------------- | --------- |
@@ -310,13 +308,13 @@
310
308
  | `marginRight` | 右边距,单位rpx | `Number/String` | `0` | - | `v1.10.0` |
311
309
  | `columnGap` | 复选框和文本间距,单位rpx | `Number/String` | `16` | - | `v1.10.0` |
312
310
 
313
- #### CheckboxGroup Events
311
+ ## CheckboxGroup Events
314
312
 
315
313
  | 事件名 | 说明 | 事件参数 | 支持版本 |
316
314
  | -------- | ------------------------ | ----------------------- | -------- |
317
315
  | `change` | 当绑定值变化时触发的事件 | `value`:改变后的绑定值 | - |
318
316
 
319
- #### Checkbox Slots
317
+ ## Checkbox Slots
320
318
 
321
319
  | 插槽名 | 说明 | 插槽参数 | 支持版本 |
322
320
  | --------- | -------------- | ------------------------------------------------------------ | -------- |
@@ -116,7 +116,6 @@
116
116
  {
117
117
  "name": "[event]click",
118
118
  "description": "点击复选框时触发的事件",
119
- "type": "(value:string | number,suspend: ()=>void,next: ()=>void,stop: ()=>void) => void",
120
119
  "params": [
121
120
  {
122
121
  "name": "value",
@@ -139,7 +138,6 @@
139
138
  {
140
139
  "name": "[event]change",
141
140
  "description": "当绑定值变化时触发的事件",
142
- "type": "(value: string | number) => void",
143
141
  "params": [
144
142
  {
145
143
  "name": "value",
@@ -148,4 +146,4 @@
148
146
  ]
149
147
  }
150
148
  ]
151
- }
149
+ }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useSlots, computed, ref, nextTick, onMounted, onUnmounted, type CSSProperties } from 'vue';
2
+ import { useSlots, computed, ref, watch, onMounted, onUnmounted, type CSSProperties } from 'vue';
3
3
  import { useColorStore } from '../../store/color';
4
4
  let { getColor } = useColorStore();
5
5
  import utils from '../../utils/utils';
@@ -25,77 +25,95 @@ const Parent = useInject<{
25
25
  registerChild: () => number;
26
26
  unregisterChild: () => void;
27
27
  }>(CHECKBOX_KEY);
28
- const parentProps = computed(() => Parent?.parent?.props);
28
+
29
+ // 🚀 优化: 使用 watch 而非 computed,避免频繁依赖追踪
30
+ const parentData = ref<{
31
+ props: Required<CheckboxGroupProps>;
32
+ updateValue: (value: any[]) => void;
33
+ registerChild: () => number;
34
+ unregisterChild: () => void;
35
+ } | null>(null);
36
+
37
+ watch(
38
+ () => Parent?.parent,
39
+ newParent => {
40
+ parentData.value = newParent || null;
41
+ },
42
+ { immediate: true }
43
+ );
29
44
 
30
45
  // 记录当前组件在 group 中的索引
31
46
  const childIndex = ref<number>(-1);
32
47
 
33
48
  onMounted(() => {
34
- if (Parent?.parent?.registerChild) {
35
- childIndex.value = Parent.parent.registerChild();
49
+ if (parentData.value?.registerChild) {
50
+ childIndex.value = parentData.value.registerChild();
36
51
  }
37
52
  });
38
53
 
39
54
  onUnmounted(() => {
40
- if (Parent?.parent?.unregisterChild) {
41
- Parent.parent.unregisterChild();
55
+ if (parentData.value?.unregisterChild) {
56
+ parentData.value.unregisterChild();
42
57
  }
43
58
  });
44
59
 
45
- // 🚀 优化: 缓存 themeColor,避免每次调用 getColor()
60
+ // 🚀 优化: 缓存 themeColor
46
61
  const themeColor = getColor().steThemeColor;
47
62
 
48
63
  // 强制更新选中状态
49
- let num = ref(1);
64
+ const num = ref(1);
65
+
66
+ // 是否在 group 中
67
+ const inGroup = computed(() => !!parentData.value);
50
68
 
51
- // 🚀 优化: 只保留必要的 computed
69
+ // 🚀 优化: 只保留必要的 computed,直接使用 parentData.value
52
70
  const cmpChecked = computed(() => {
53
- let v = num.value && parentProps.value ? parentProps.value.modelValue.includes(props.name) : props.modelValue;
54
- return v;
71
+ if (inGroup.value) {
72
+ return num.value > 0 && parentData.value!.props.modelValue.includes(props.name);
73
+ }
74
+ return props.modelValue;
55
75
  });
56
76
 
57
77
  const cmpDisabled = computed(() => {
58
- let disabled = getDefaultData('disabled', false);
78
+ let disabled = props.disabled ?? parentData.value?.props.disabled ?? false;
59
79
  // 限制最大可选数
60
- if (parentProps.value && parentProps.value.max) {
61
- if (!cmpChecked.value && parentProps.value.modelValue.length >= parentProps.value.max) {
80
+ if (inGroup.value && parentData.value!.props.max > 0) {
81
+ if (!cmpChecked.value && parentData.value!.props.modelValue.length >= parentData.value!.props.max) {
62
82
  disabled = true;
63
83
  }
64
84
  }
65
85
  return disabled;
66
86
  });
67
87
 
68
- // 🚀 优化: 合并所有样式计算,直接调用 getDefaultData
88
+ // 🚀 优化: 合并所有样式计算
69
89
  const cmpRootStyle = computed(() => {
70
- const textSize = getDefaultData('textSize', 28);
71
- const textPosition = getDefaultData('textPosition', 'right');
72
- const readonly = getDefaultData('readonly', false);
73
- const textDisabled = getDefaultData('textDisabled', false);
90
+ const textSize = props.textSize ?? parentData.value?.props.textSize ?? 28;
91
+ const textPosition = props.textPosition ?? parentData.value?.props.textPosition ?? 'right';
92
+ const readonly = props.readonly ?? parentData.value?.props.readonly ?? false;
93
+ const textDisabled = props.textDisabled ?? parentData.value?.props.textDisabled ?? false;
74
94
 
75
- let marginLeft = getDefaultData('marginLeft', '0');
76
- let marginRight = getDefaultData('marginRight', '0');
95
+ let marginLeft = props.marginLeft ?? parentData.value?.props.marginLeft ?? '0';
96
+ let marginRight = props.marginRight ?? parentData.value?.props.marginRight ?? '0';
77
97
 
78
98
  // 如果在 checkbox-group 中,并且不是第一个元素,自动应用间距
79
- if (parentProps.value && childIndex.value > 0 && marginLeft === '0') {
80
- const direction = parentProps.value.direction || 'column';
81
-
99
+ if (inGroup.value && childIndex.value > 0 && marginLeft === '0') {
100
+ const direction = parentData.value!.props.direction || 'column';
82
101
  if (direction === 'row') {
83
- // 横向排列时,设置左间距 16rpx
84
102
  marginLeft = '16';
85
103
  }
86
104
  }
87
105
 
88
106
  const style: CSSProperties = {
89
107
  fontSize: `var(--font-size-${textSize},${utils.formatPx(textSize)})`,
90
- color: cmpChecked.value ? getDefaultData('textActiveColor', '#000000') : getDefaultData('textInactiveColor', '#000000'),
108
+ color: cmpChecked.value ? (props.textActiveColor ?? parentData.value?.props.textActiveColor ?? '#000000') : (props.textInactiveColor ?? parentData.value?.props.textInactiveColor ?? '#000000'),
91
109
  flexDirection: textPosition === 'right' ? 'row' : 'row-reverse',
92
110
  marginLeft: utils.formatPx(marginLeft),
93
111
  marginRight: utils.formatPx(marginRight),
94
112
  };
95
113
 
96
114
  // 纵向排列时,设置上间距 16rpx
97
- if (parentProps.value && childIndex.value > 0) {
98
- const direction = parentProps.value.direction || 'column';
115
+ if (inGroup.value && childIndex.value > 0) {
116
+ const direction = parentData.value!.props.direction || 'column';
99
117
  if (direction === 'column') {
100
118
  style.marginTop = '16rpx';
101
119
  }
@@ -119,16 +137,17 @@ const cmpRootStyle = computed(() => {
119
137
  });
120
138
 
121
139
  const cmpIconStyle = computed(() => {
140
+ const columnGap = props.columnGap ?? parentData.value?.props.columnGap ?? '16';
122
141
  return {
123
- marginRight: utils.formatPx(getDefaultData('columnGap', '16')),
142
+ marginRight: utils.formatPx(columnGap),
124
143
  } as CSSProperties;
125
144
  });
126
145
 
127
146
  const cmpInputStyle = computed(() => {
128
- const shape = getDefaultData('shape', 'circle');
129
- const iconSize = getDefaultData('iconSize', 36);
130
- const checkedColor = getDefaultData('checkedColor', themeColor);
131
- const readonly = getDefaultData('readonly', false);
147
+ const shape = props.shape ?? parentData.value?.props.shape ?? 'circle';
148
+ const iconSize = props.iconSize ?? parentData.value?.props.iconSize ?? 36;
149
+ const checkedColor = props.checkedColor ?? parentData.value?.props.checkedColor ?? themeColor;
150
+ const readonly = props.readonly ?? parentData.value?.props.readonly ?? false;
132
151
  const checked = cmpChecked.value;
133
152
 
134
153
  const style: CSSProperties = {
@@ -161,7 +180,7 @@ const cmpInputStyle = computed(() => {
161
180
  const cmpSlotProps = computed(() => ({
162
181
  checked: cmpChecked.value,
163
182
  disabled: cmpDisabled.value,
164
- readonly: getDefaultData('readonly', false),
183
+ readonly: props.readonly ?? parentData.value?.props.readonly ?? false,
165
184
  }));
166
185
 
167
186
  const cmpIconMargin = computed(() => {
@@ -174,41 +193,9 @@ const cmpIconMargin = computed(() => {
174
193
  // #endif
175
194
  });
176
195
 
177
- // 批处理更新相关
178
- const isBatchUpdating = ref(false);
179
- const pendingUpdate = ref(false);
180
-
181
- // 批处理更新函数
182
- const batchedUpdate = async (updateFn: () => Promise<void>) => {
183
- if (isBatchUpdating.value) {
184
- pendingUpdate.value = true;
185
- return;
186
- }
187
-
188
- isBatchUpdating.value = true;
189
-
190
- try {
191
- await updateFn();
192
- } finally {
193
- await nextTick();
194
- isBatchUpdating.value = false;
195
-
196
- // 处理待处理的更新
197
- if (pendingUpdate.value) {
198
- pendingUpdate.value = false;
199
- // 如果有待处理的更新,延迟一帧再处理
200
- requestAnimationFrame(() => {
201
- if (!isBatchUpdating.value) {
202
- handleClick();
203
- }
204
- });
205
- }
206
- }
207
- };
208
-
209
- // 实际的点击处理逻辑
210
- const handleClick = async () => {
211
- const readonly = getDefaultData('readonly', false);
196
+ // 🚀 优化: 简化点击处理,移除 batchedUpdate 和不必要的 async/await
197
+ const handleClick = () => {
198
+ const readonly = props.readonly ?? parentData.value?.props.readonly ?? false;
212
199
 
213
200
  if (cmpDisabled.value || readonly) {
214
201
  return;
@@ -226,23 +213,20 @@ const handleClick = async () => {
226
213
  });
227
214
 
228
215
  if (!next) {
229
- try {
230
- await stop;
231
- } catch (e) {
232
- return;
233
- }
216
+ stop.catch(() => {});
217
+ return;
234
218
  }
235
219
 
236
220
  let value: boolean | any[];
237
- if (parentProps.value) {
221
+ if (inGroup.value) {
238
222
  // 使用浅拷贝避免直接修改原数组
239
- value = [...parentProps.value.modelValue];
223
+ value = [...parentData.value!.props.modelValue];
240
224
  if (cmpChecked.value) {
241
225
  value = value.filter(v => v !== props.name);
242
226
  } else {
243
227
  value.push(props.name);
244
228
  }
245
- Parent.parent?.updateValue(value);
229
+ parentData.value!.updateValue(value);
246
230
  num.value++;
247
231
  } else {
248
232
  value = !cmpChecked.value;
@@ -252,14 +236,21 @@ const handleClick = async () => {
252
236
  };
253
237
 
254
238
  const click = () => {
255
- batchedUpdate(handleClick);
239
+ handleClick();
256
240
  };
257
241
 
242
+ // 获取配置值的快捷方法(保留兼容)
258
243
  type PropsKeyType = keyof typeof props;
259
244
  const getDefaultData = <T,>(key: PropsKeyType, defaultValue: T): T => {
260
245
  const value = props[key];
261
- return value !== undefined && value !== '' ? (value as T) : defaultValue;
246
+ if (value !== undefined && value !== null && value !== '') return value as T;
247
+ const parentVal = parentData.value?.props[key as keyof typeof props];
248
+ if (parentVal !== undefined && parentVal !== null && parentVal !== '') return parentVal as T;
249
+ return defaultValue;
262
250
  };
251
+
252
+ // 图标大小(用于模板中)
253
+ const iconSize = computed(() => props.iconSize ?? parentData.value?.props.iconSize ?? 36);
263
254
  </script>
264
255
 
265
256
  <template>
@@ -267,7 +258,7 @@ const getDefaultData = <T,>(key: PropsKeyType, defaultValue: T): T => {
267
258
  <view class="icon" :style="[cmpIconStyle]">
268
259
  <slot name="icon" :slotProps="cmpSlotProps">
269
260
  <view class="input-icon" :style="[cmpInputStyle]">
270
- <ste-icon v-if="cmpChecked" :size="getDefaultData('iconSize', 36) * 0.8" code="&#xe67a;" :color="cmpDisabled ? '#bbbbbb' : '#fff'" bold :marginBottom="cmpIconMargin" />
261
+ <ste-icon v-if="cmpChecked" :size="iconSize * 0.8" code="&#xe67a;" :color="cmpDisabled ? '#bbbbbb' : '#fff'" bold :marginBottom="cmpIconMargin" />
271
262
  </view>
272
263
  </slot>
273
264
  </view>
@@ -1,4 +1,6 @@
1
- #### Props
1
+ ## API
2
+
3
+ ### Props
2
4
  | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
3
5
  | ----- | ----- | --- | ------- | ------ | -------- |
4
6
  | `value` | 初始内容,支持双向绑定 | `string / number` | - | - | - |
@@ -15,8 +17,10 @@
15
17
  | `readOnly` | 是否只读 | `boolean` | `false` | - | - |
16
18
 
17
19
 
18
- #### Events
20
+ ### Events
19
21
  | 事件名 | 说明 | 事件参数 | 支持版本 |
20
22
  | ----- | ----- | ------- | -------- |
21
- | `change` | 改变时触发 | - | - |
22
- | `finish` | 输入完成触发 | - | - |
23
+ | `change` | 改变时触发 | `data`:(value: string / number) => void | - |
24
+ | `finish` | 输入完成触发 | `data`:(value: string / number) => void | - |
25
+
26
+
@@ -4,9 +4,9 @@
4
4
 
5
5
  ---$
6
6
 
7
- ### 代码演示
7
+ ## 代码演示
8
8
 
9
- #### 基础使用
9
+ ## 基础使用
10
10
 
11
11
  ```html
12
12
  <template>
@@ -15,7 +15,7 @@
15
15
  </template>
16
16
  ```
17
17
 
18
- #### 横线模式
18
+ ## 横线模式
19
19
 
20
20
  ```html
21
21
  <template>
@@ -23,7 +23,7 @@
23
23
  </template>
24
24
  ```
25
25
 
26
- #### 设置长度
26
+ ## 设置长度
27
27
 
28
28
  ```html
29
29
  <template>
@@ -31,7 +31,7 @@
31
31
  </template>
32
32
  ```
33
33
 
34
- #### 设置间距
34
+ ## 设置间距
35
35
 
36
36
  ```html
37
37
  <template>
@@ -39,7 +39,7 @@
39
39
  </template>
40
40
  ```
41
41
 
42
- #### 调整颜色
42
+ ## 调整颜色
43
43
 
44
44
  ```html
45
45
  <template>
@@ -48,7 +48,7 @@
48
48
  </template>
49
49
  ```
50
50
 
51
- #### 自定义显示
51
+ ## 自定义显示
52
52
 
53
53
  ```html
54
54
  <template>
@@ -59,8 +59,6 @@
59
59
 
60
60
  ---$
61
61
 
62
- ### API
63
-
64
62
  <!-- props -->
65
63
 
66
64
  ---$
@@ -37,7 +37,6 @@
37
37
  "type": "string | number",
38
38
  "default": 16
39
39
  },
40
-
41
40
  {
42
41
  "name": "fontColor",
43
42
  "description": "字体颜色",
@@ -88,12 +87,22 @@
88
87
  {
89
88
  "name": "[event]change",
90
89
  "description": "改变时触发",
91
- "type": "(value: string | number) => void"
90
+ "params": [
91
+ {
92
+ "name": "data",
93
+ "description": "(value: string | number) => void"
94
+ }
95
+ ]
92
96
  },
93
97
  {
94
98
  "name": "[event]finish",
95
99
  "description": "输入完成触发",
96
- "type": "(value: string | number) => void"
100
+ "params": [
101
+ {
102
+ "name": "data",
103
+ "description": "(value: string | number) => void"
104
+ }
105
+ ]
97
106
  }
98
107
  ]
99
- }
108
+ }
@@ -1,4 +1,6 @@
1
- #### Props
1
+ ## API
2
+
3
+ ### Props
2
4
  | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
3
5
  | ----- | ----- | --- | ------- | ------ | -------- |
4
6
  | `width` | 图表宽度,单位rpx | `number / string` | `750` | - | - |
@@ -3,9 +3,9 @@
3
3
  柱状图(或称条形图)是一种通过柱形的长度来表现数据大小的一种常用图表类型
4
4
  ---$
5
5
 
6
- ### 代码演示
6
+ ## 代码演示
7
7
 
8
- #### 默认配置
8
+ ## 默认配置
9
9
 
10
10
  ```html
11
11
  <template>
@@ -26,7 +26,7 @@
26
26
  </script>
27
27
  ```
28
28
 
29
- #### 多图例
29
+ ## 多图例
30
30
 
31
31
  ```html
32
32
  <template>
@@ -51,7 +51,7 @@
51
51
  </script>
52
52
  ```
53
53
 
54
- #### 堆叠
54
+ ## 堆叠
55
55
 
56
56
  ```html
57
57
  <template>
@@ -78,7 +78,7 @@
78
78
  </script>
79
79
  ```
80
80
 
81
- #### 迷你图表
81
+ ## 迷你图表
82
82
 
83
83
  ```html
84
84
  <template>
@@ -109,8 +109,6 @@
109
109
 
110
110
  ---$
111
111
 
112
- ### API
113
-
114
112
  <!-- props -->
115
113
 
116
114
  ---$
@@ -1,4 +1,6 @@
1
- #### Props
1
+ ## API
2
+
3
+ ### Props
2
4
  | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
3
5
  | ----- | ----- | --- | ------- | ------ | -------- |
4
6
  | `tags` | 标签数组 | `string[]` | `[]` | - | - |
@@ -4,7 +4,7 @@
4
4
 
5
5
  ---$
6
6
 
7
- ### 基础用法
7
+ ## 基础用法
8
8
 
9
9
  - 属性`tags`用于接收顶部标签列表,默认值`[]`
10
10
  - 属性`total`用于接收评论总数,默认值`0`
@@ -42,11 +42,9 @@
42
42
 
43
43
  ---$
44
44
 
45
- ### API
46
-
47
45
  <!-- props -->
48
46
 
49
- #### CommentType
47
+ ## CommentType
50
48
 
51
49
  | 属性 | 说明 | 类型 |
52
50
  | ------------ | ------------ | ---------- |
@@ -1,4 +1,6 @@
1
- #### Props
1
+ ## API
2
+
3
+ ### Props
2
4
  | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
3
5
  | ----- | ----- | --- | ------- | ------ | -------- |
4
6
  | `data` | 基础数据 | `{title: string;desc?: string;image: string;price: string / number;constraint?: string;footers?: string[]}` | `{}` | - | - |
@@ -10,9 +12,17 @@
10
12
  | `backgroundColor` | 背景颜色 | `string` | `#fff` | - | - |
11
13
 
12
14
 
13
- #### Events
15
+ ### Events
14
16
  | 事件名 | 说明 | 事件参数 | 支持版本 |
15
17
  | ----- | ----- | ------- | -------- |
16
- | `buttonClick` | 点击按钮时触发 | - | - |
17
- | `footerClick` | 点击页脚列表时触发 | - | - |
18
- | `countDown` | 倒计时触发 | - | - |
18
+ | `buttonClick` | 点击按钮时触发 | `data`:() => void | - |
19
+ | `footerClick` | 点击页脚列表时触发 | `data`:(index:number) => void | - |
20
+ | `countDown` | 倒计时触发 | `data`:(data:any,time:number) => void | - |
21
+
22
+
23
+ ### Slots
24
+ | 插槽名 | 说明 | 参数 | 支持版本 |
25
+ | ----- | ----- | --- | -------- |
26
+ | `position` | 在任意位置插入内容 | - | - |
27
+
28
+