stellar-ui-plus 1.25.0 → 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.
- package/components/ste-animate/ATTRIBUTES.md +13 -5
- package/components/ste-animate/README.md +4 -28
- package/components/ste-animate/ste-animate.easycom.json +31 -9
- package/components/ste-app-update/ATTRIBUTES.md +11 -5
- package/components/ste-app-update/README.md +1 -3
- package/components/ste-app-update/method.ts +44 -1
- package/components/ste-app-update/props.ts +17 -2
- package/components/ste-app-update/ste-app-update.easycom.json +18 -8
- package/components/ste-app-update/ste-app-update.vue +93 -18
- package/components/ste-area-chart/ATTRIBUTES.md +3 -1
- package/components/ste-area-chart/README.md +4 -4
- package/components/ste-badge/ATTRIBUTES.md +10 -1
- package/components/ste-badge/README.md +9 -18
- package/components/ste-badge/ste-badge.easycom.json +8 -0
- package/components/ste-bar-chart/ATTRIBUTES.md +3 -1
- package/components/ste-bar-chart/README.md +3 -5
- package/components/ste-barcode/ATTRIBUTES.md +6 -2
- package/components/ste-barcode/README.md +3 -5
- package/components/ste-barcode/ste-barcode.easycom.json +1 -2
- package/components/ste-button/ATTRIBUTES.md +24 -14
- package/components/ste-button/README.md +11 -19
- package/components/ste-button/ste-button.easycom.json +76 -12
- package/components/ste-calendar/ATTRIBUTES.md +12 -2
- package/components/ste-calendar/README.md +16 -24
- package/components/ste-calendar/ste-calendar.easycom.json +4 -3
- package/components/ste-category/ATTRIBUTES.md +6 -2
- package/components/ste-category/README.md +2 -4
- package/components/ste-category/ste-category.easycom.json +1 -2
- package/components/ste-checkbox/ATTRIBUTES.md +6 -2
- package/components/ste-checkbox/README.md +18 -20
- package/components/ste-checkbox/ste-checkbox.easycom.json +1 -3
- package/components/ste-checkbox/ste-checkbox.vue +71 -80
- package/components/ste-code-input/ATTRIBUTES.md +8 -4
- package/components/ste-code-input/README.md +7 -9
- package/components/ste-code-input/ste-code-input.easycom.json +13 -4
- package/components/ste-column-chart/ATTRIBUTES.md +3 -1
- package/components/ste-column-chart/README.md +5 -7
- package/components/ste-comment/ATTRIBUTES.md +3 -1
- package/components/ste-comment/README.md +2 -4
- package/components/ste-coupon-list/ATTRIBUTES.md +15 -5
- package/components/ste-coupon-list/README.md +6 -14
- package/components/ste-coupon-list/ste-coupon-list.easycom.json +22 -3
- package/components/ste-custom-keyboard/ATTRIBUTES.md +16 -7
- package/components/ste-custom-keyboard/README.md +10 -18
- package/components/ste-custom-keyboard/ste-custom-keyboard.easycom.json +28 -10
- package/components/ste-date-picker/ATTRIBUTES.md +9 -5
- package/components/ste-date-picker/README.md +9 -11
- package/components/ste-date-picker/ste-date-picker.easycom.json +19 -4
- package/components/ste-date-user/ATTRIBUTES.md +9 -1
- package/components/ste-date-user/README.md +3 -11
- package/components/ste-date-user/ste-date-user.easycom.json +4 -0
- package/components/ste-drag/ATTRIBUTES.md +13 -3
- package/components/ste-drag/README.md +5 -13
- package/components/ste-drag/ste-drag.easycom.json +10 -2
- package/components/ste-drag-sort/ATTRIBUTES.md +25 -0
- package/components/ste-drag-sort/README.md +116 -0
- package/components/ste-drag-sort/config.json +5 -0
- package/components/ste-drag-sort/props.ts +16 -0
- package/components/ste-drag-sort/ste-drag-sort.easycom.json +88 -0
- package/components/ste-drag-sort/ste-drag-sort.vue +589 -0
- package/components/ste-dropdown-menu/ATTRIBUTES.md +8 -4
- package/components/ste-dropdown-menu/README.md +14 -16
- package/components/ste-dropdown-menu/ste-dropdown-menu.easycom.json +13 -4
- package/components/ste-filter-tool/ATTRIBUTES.md +6 -2
- package/components/ste-filter-tool/README.md +4 -6
- package/components/ste-filter-tool/ste-filter-tool.easycom.json +1 -5
- package/components/ste-function-list/ATTRIBUTES.md +13 -2
- package/components/ste-function-list/README.md +3 -12
- package/components/ste-function-list/ste-function-list.easycom.json +8 -3
- package/components/ste-funnel-chart/ATTRIBUTES.md +3 -1
- package/components/ste-funnel-chart/README.md +4 -6
- package/components/ste-goods-info/ATTRIBUTES.md +15 -4
- package/components/ste-goods-info/README.md +8 -17
- package/components/ste-goods-info/ste-goods-info.easycom.json +40 -13
- package/components/ste-goods-list/ATTRIBUTES.md +9 -1
- package/components/ste-goods-list/README.md +4 -12
- package/components/ste-goods-list/ste-goods-list.easycom.json +4 -0
- package/components/ste-guide-qa/ATTRIBUTES.md +15 -4
- package/components/ste-guide-qa/README.md +6 -15
- package/components/ste-guide-qa/ste-guide-qa.easycom.json +20 -2
- package/components/ste-icon/ATTRIBUTES.md +7 -3
- package/components/ste-icon/README.md +5 -7
- package/components/ste-icon/ste-icon.easycom.json +7 -2
- package/components/ste-image/ATTRIBUTES.md +13 -2
- package/components/ste-image/README.md +6 -15
- package/components/ste-image/ste-image.easycom.json +8 -3
- package/components/ste-index-list/ATTRIBUTES.md +8 -4
- package/components/ste-index-list/README.md +6 -8
- package/components/ste-index-list/ste-index-list.easycom.json +13 -3
- package/components/ste-input/ATTRIBUTES.md +14 -3
- package/components/ste-input/README.md +16 -25
- package/components/ste-input/ste-input.easycom.json +14 -5
- package/components/ste-line-chart/ATTRIBUTES.md +3 -1
- package/components/ste-line-chart/README.md +5 -7
- package/components/ste-loading/ATTRIBUTES.md +3 -1
- package/components/ste-loading/README.md +6 -8
- package/components/ste-login/ATTRIBUTES.md +12 -2
- package/components/ste-login/README.md +7 -15
- package/components/ste-login/ste-login.easycom.json +4 -7
- package/components/ste-login-info/ATTRIBUTES.md +6 -2
- package/components/ste-login-info/README.md +2 -4
- package/components/ste-login-info/ste-login-info.easycom.json +1 -4
- package/components/ste-marquee/ATTRIBUTES.md +44 -0
- package/components/ste-marquee/README.md +123 -0
- package/components/ste-marquee/config.json +5 -0
- package/components/ste-marquee/props.ts +106 -0
- package/components/ste-marquee/ste-marquee.easycom.json +132 -0
- package/components/ste-marquee/ste-marquee.vue +249 -0
- package/components/ste-media-preview/ATTRIBUTES.md +14 -4
- package/components/ste-media-preview/README.md +23 -32
- package/components/ste-media-preview/ste-media-preview.easycom.json +16 -4
- package/components/ste-message-box/ATTRIBUTES.md +3 -1
- package/components/ste-message-box/README.md +11 -13
- package/components/ste-navbar/ATTRIBUTES.md +13 -3
- package/components/ste-navbar/README.md +5 -13
- package/components/ste-navbar/ste-navbar.easycom.json +10 -1
- package/components/ste-notice-bar/ATTRIBUTES.md +16 -5
- package/components/ste-notice-bar/README.md +11 -20
- package/components/ste-notice-bar/ste-notice-bar.easycom.json +26 -3
- package/components/ste-number-keyboard/ATTRIBUTES.md +17 -7
- package/components/ste-number-keyboard/README.md +9 -18
- package/components/ste-number-keyboard/ste-number-keyboard.easycom.json +32 -9
- package/components/ste-order-card/ATTRIBUTES.md +6 -2
- package/components/ste-order-card/README.md +4 -6
- package/components/ste-order-card/ste-order-card.easycom.json +1 -4
- package/components/ste-pie-chart/ATTRIBUTES.md +3 -1
- package/components/ste-pie-chart/README.md +4 -6
- package/components/ste-popup/ATTRIBUTES.md +15 -5
- package/components/ste-popup/README.md +10 -18
- package/components/ste-popup/ste-popup.easycom.json +22 -4
- package/components/ste-price/ATTRIBUTES.md +7 -3
- package/components/ste-price/README.md +10 -12
- package/components/ste-price/ste-price.easycom.json +7 -2
- package/components/ste-progress/ATTRIBUTES.md +9 -1
- package/components/ste-progress/README.md +9 -17
- package/components/ste-progress/ste-progress.easycom.json +4 -0
- package/components/ste-qrcode/ATTRIBUTES.md +6 -2
- package/components/ste-qrcode/README.md +4 -6
- package/components/ste-qrcode/ste-qrcode.easycom.json +1 -2
- package/components/ste-radio/ATTRIBUTES.md +6 -2
- package/components/ste-radio/README.md +17 -19
- package/components/ste-radio/ste-radio.easycom.json +1 -3
- package/components/ste-radio/ste-radio.vue +109 -85
- package/components/ste-rate/ATTRIBUTES.md +7 -3
- package/components/ste-rate/README.md +8 -10
- package/components/ste-rate/ste-rate.easycom.json +7 -2
- package/components/ste-read-more/ATTRIBUTES.md +20 -4
- package/components/ste-read-more/README.md +5 -19
- package/components/ste-read-more/ste-read-more.easycom.json +20 -2
- package/components/ste-rich-text/ATTRIBUTES.md +3 -1
- package/components/ste-rich-text/README.md +2 -4
- package/components/ste-ring-chart/ATTRIBUTES.md +3 -1
- package/components/ste-ring-chart/README.md +22 -5
- package/components/ste-ring-chart/ste-ring-chart.vue +40 -1
- package/components/ste-scroll-to/ATTRIBUTES.md +7 -3
- package/components/ste-scroll-to/README.md +2 -4
- package/components/ste-scroll-to/ste-scroll-to.easycom.json +7 -2
- package/components/ste-search/ATTRIBUTES.md +14 -3
- package/components/ste-search/README.md +12 -21
- package/components/ste-search/ste-search.easycom.json +14 -7
- package/components/ste-search-box/ATTRIBUTES.md +6 -2
- package/components/ste-search-box/README.md +3 -5
- package/components/ste-search-box/ste-search-box.easycom.json +1 -3
- package/components/ste-select/ATTRIBUTES.md +9 -5
- package/components/ste-select/README.md +11 -11
- package/components/ste-select/ste-select.easycom.json +19 -6
- package/components/ste-select-seat/ATTRIBUTES.md +8 -4
- package/components/ste-select-seat/README.md +7 -21
- package/components/ste-select-seat/ste-select-seat.easycom.json +13 -3
- package/components/ste-signature/ATTRIBUTES.md +18 -5
- package/components/ste-signature/README.md +3 -14
- package/components/ste-signature/ste-signature.easycom.json +50 -3
- package/components/ste-simple-calendar/ATTRIBUTES.md +16 -4
- package/components/ste-simple-calendar/README.md +8 -18
- package/components/ste-simple-calendar/ste-simple-calendar.easycom.json +30 -2
- package/components/ste-skeleton/ATTRIBUTES.md +9 -1
- package/components/ste-skeleton/README.md +5 -13
- package/components/ste-skeleton/ste-skeleton.easycom.json +4 -0
- package/components/ste-slide-verify/ATTRIBUTES.md +16 -5
- package/components/ste-slide-verify/README.md +7 -16
- package/components/ste-slide-verify/ste-slide-verify.easycom.json +26 -3
- package/components/ste-slider/ATTRIBUTES.md +14 -2
- package/components/ste-slider/README.md +12 -21
- package/components/ste-slider/ste-slider.easycom.json +12 -4
- package/components/ste-slider/ste-slider.vue +5 -3
- package/components/ste-stepper/ATTRIBUTES.md +9 -5
- package/components/ste-stepper/README.md +9 -13
- package/components/ste-stepper/ste-stepper.easycom.json +19 -6
- package/components/ste-steps/ATTRIBUTES.md +6 -2
- package/components/ste-steps/README.md +9 -11
- package/components/ste-steps/ste-steps.easycom.json +1 -2
- package/components/ste-sticky/ATTRIBUTES.md +8 -4
- package/components/ste-sticky/README.md +2 -4
- package/components/ste-sticky/ste-sticky.easycom.json +13 -3
- package/components/ste-swipe-action/ATTRIBUTES.md +14 -3
- package/components/ste-swipe-action/README.md +9 -18
- package/components/ste-swipe-action/ste-swipe-action.easycom.json +20 -2
- package/components/ste-swipe-action/useData.ts +15 -8
- package/components/ste-swipe-action-group/ATTRIBUTES.md +6 -2
- package/components/ste-swipe-action-group/ste-swipe-action-group.easycom.json +1 -3
- package/components/ste-swiper/ATTRIBUTES.md +6 -2
- package/components/ste-swiper/README.md +12 -14
- package/components/ste-swiper/ste-swiper.easycom.json +1 -3
- package/components/ste-switch/ATTRIBUTES.md +8 -4
- package/components/ste-switch/README.md +7 -9
- package/components/ste-switch/ste-switch.easycom.json +13 -3
- package/components/ste-tab/ATTRIBUTES.md +3 -1
- package/components/ste-table/ATTRIBUTES.md +12 -8
- package/components/ste-table/README.md +23 -23
- package/components/ste-table/ste-table.easycom.json +38 -9
- package/components/ste-tabs/ATTRIBUTES.md +9 -4
- package/components/ste-tabs/README.md +4 -6
- package/components/ste-tabs/props.ts +3 -0
- package/components/ste-tabs/ste-tabs.easycom.json +18 -2
- package/components/ste-tabs/useData.ts +1 -1
- package/components/ste-text/ATTRIBUTES.md +9 -1
- package/components/ste-text/README.md +4 -12
- package/components/ste-text/ste-text.easycom.json +4 -0
- package/components/ste-toast/ATTRIBUTES.md +10 -1
- package/components/ste-toast/README.md +9 -18
- package/components/ste-toast/ste-toast.easycom.json +14 -0
- package/components/ste-touch-swipe/ATTRIBUTES.md +6 -2
- package/components/ste-touch-swipe/README.md +4 -6
- package/components/ste-touch-swipe/ste-touch-swipe.easycom.json +1 -2
- package/components/ste-tour/ATTRIBUTES.md +7 -3
- package/components/ste-tour/README.md +5 -7
- package/components/ste-tour/ste-tour.easycom.json +11 -4
- package/components/ste-tree/ATTRIBUTES.md +15 -2
- package/components/ste-tree/README.md +6 -17
- package/components/ste-tree/ste-tree.easycom.json +16 -4
- package/components/ste-upload/ATTRIBUTES.md +17 -5
- package/components/ste-upload/README.md +9 -20
- package/components/ste-upload/ste-upload.easycom.json +36 -9
- package/components/ste-user-info/ATTRIBUTES.md +15 -5
- package/components/ste-user-info/README.md +5 -13
- package/components/ste-user-info/ste-user-info.easycom.json +22 -4
- package/components/ste-video/ATTRIBUTES.md +3 -1
- package/components/ste-video/README.md +4 -8
- package/components/ste-watermark/ATTRIBUTES.md +3 -1
- package/components/ste-watermark/README.md +5 -7
- package/config/font-size.ts +3 -0
- package/config/index.ts +5 -0
- package/index.ts +4 -0
- package/package.json +1 -1
- package/types/components.d.ts +4 -0
- package/types/refComponents.d.ts +4 -0
- package/utils/System.ts +50 -15
- 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
|
-
|
|
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
|
-
|
|
311
|
+
## CheckboxGroup Events
|
|
314
312
|
|
|
315
313
|
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
316
314
|
| -------- | ------------------------ | ----------------------- | -------- |
|
|
317
315
|
| `change` | 当绑定值变化时触发的事件 | `value`:改变后的绑定值 | - |
|
|
318
316
|
|
|
319
|
-
|
|
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,
|
|
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
|
-
|
|
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 (
|
|
35
|
-
childIndex.value =
|
|
49
|
+
if (parentData.value?.registerChild) {
|
|
50
|
+
childIndex.value = parentData.value.registerChild();
|
|
36
51
|
}
|
|
37
52
|
});
|
|
38
53
|
|
|
39
54
|
onUnmounted(() => {
|
|
40
|
-
if (
|
|
41
|
-
|
|
55
|
+
if (parentData.value?.unregisterChild) {
|
|
56
|
+
parentData.value.unregisterChild();
|
|
42
57
|
}
|
|
43
58
|
});
|
|
44
59
|
|
|
45
|
-
// 🚀 优化: 缓存 themeColor
|
|
60
|
+
// 🚀 优化: 缓存 themeColor
|
|
46
61
|
const themeColor = getColor().steThemeColor;
|
|
47
62
|
|
|
48
63
|
// 强制更新选中状态
|
|
49
|
-
|
|
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
|
-
|
|
54
|
-
|
|
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 =
|
|
78
|
+
let disabled = props.disabled ?? parentData.value?.props.disabled ?? false;
|
|
59
79
|
// 限制最大可选数
|
|
60
|
-
if (
|
|
61
|
-
if (!cmpChecked.value &&
|
|
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
|
-
// 🚀 优化:
|
|
88
|
+
// 🚀 优化: 合并所有样式计算
|
|
69
89
|
const cmpRootStyle = computed(() => {
|
|
70
|
-
const textSize =
|
|
71
|
-
const textPosition =
|
|
72
|
-
const readonly =
|
|
73
|
-
const textDisabled =
|
|
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 =
|
|
76
|
-
let marginRight =
|
|
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 (
|
|
80
|
-
const direction =
|
|
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 ?
|
|
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 (
|
|
98
|
-
const direction =
|
|
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(
|
|
142
|
+
marginRight: utils.formatPx(columnGap),
|
|
124
143
|
} as CSSProperties;
|
|
125
144
|
});
|
|
126
145
|
|
|
127
146
|
const cmpInputStyle = computed(() => {
|
|
128
|
-
const shape =
|
|
129
|
-
const iconSize =
|
|
130
|
-
const checkedColor =
|
|
131
|
-
const readonly =
|
|
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:
|
|
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
|
|
179
|
-
const
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
} catch (e) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
216
|
+
stop.catch(() => {});
|
|
217
|
+
return;
|
|
234
218
|
}
|
|
235
219
|
|
|
236
220
|
let value: boolean | any[];
|
|
237
|
-
if (
|
|
221
|
+
if (inGroup.value) {
|
|
238
222
|
// 使用浅拷贝避免直接修改原数组
|
|
239
|
-
value = [...
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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="
|
|
261
|
+
<ste-icon v-if="cmpChecked" :size="iconSize * 0.8" code="" :color="cmpDisabled ? '#bbbbbb' : '#fff'" bold :marginBottom="cmpIconMargin" />
|
|
271
262
|
</view>
|
|
272
263
|
</slot>
|
|
273
264
|
</view>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
"
|
|
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
|
-
"
|
|
100
|
+
"params": [
|
|
101
|
+
{
|
|
102
|
+
"name": "data",
|
|
103
|
+
"description": "(value: string | number) => void"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
97
106
|
}
|
|
98
107
|
]
|
|
99
|
-
}
|
|
108
|
+
}
|
|
@@ -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
|
---$
|
|
@@ -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
|
-
|
|
47
|
+
## CommentType
|
|
50
48
|
|
|
51
49
|
| 属性 | 说明 | 类型 |
|
|
52
50
|
| ------------ | ------------ | ---------- |
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
+
|