stellar-ui-plus 1.25.1 → 1.25.3
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 +21 -4
- package/components/ste-area-chart/ste-area-chart.vue +33 -1
- 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 +20 -5
- package/components/ste-bar-chart/ste-bar-chart.vue +34 -1
- 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 +22 -7
- package/components/ste-column-chart/ste-column-chart.vue +34 -1
- 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 +21 -6
- package/components/ste-funnel-chart/ste-funnel-chart.vue +34 -1
- 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 +22 -7
- package/components/ste-line-chart/ste-line-chart.vue +34 -1
- 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 +21 -6
- package/components/ste-pie-chart/ste-pie-chart.vue +34 -1
- 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 +33 -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 +11 -21
- package/components/ste-slider/ste-slider.easycom.json +12 -4
- 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
|
@@ -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>
|
|
@@ -107,9 +107,24 @@
|
|
|
107
107
|
</script>
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
## 事件
|
|
111
|
+
|
|
112
|
+
- 属性`getImage`: 通过ref来获取实例的base64格式的图片地址,异步方法,需在实例生成后调用。
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<template>
|
|
116
|
+
<ste-column-chart :series="series" :categories="categories" ref="columnChart"></ste-column-chart>
|
|
117
|
+
</template>
|
|
118
|
+
<script setup lang="ts">
|
|
119
|
+
import { ref,onMounted } from 'vue';
|
|
120
|
+
let columnChart: any = ref(null);
|
|
121
|
+
onMounted(async () => {
|
|
122
|
+
const base64 = await columnChart.value.getImage()
|
|
123
|
+
}),
|
|
124
|
+
</script>
|
|
125
|
+
```
|
|
111
126
|
|
|
112
|
-
|
|
127
|
+
---$
|
|
113
128
|
|
|
114
129
|
<!-- props -->
|
|
115
130
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import uCharts from '../../Charts/Charts';
|
|
9
|
-
import { ref, onMounted, computed, type CSSProperties, watch, getCurrentInstance } from 'vue';
|
|
9
|
+
import { ref, onMounted, computed, type CSSProperties, watch, getCurrentInstance, type ComponentPublicInstance } from 'vue';
|
|
10
10
|
import utils from '../../utils/utils';
|
|
11
11
|
import { propsData, propsComponent } from './props';
|
|
12
12
|
import type { ChartsOptions } from '../../Charts/types/index';
|
|
@@ -96,6 +96,39 @@ function tap(e: any) {
|
|
|
96
96
|
charts.value?.touchLegend(e);
|
|
97
97
|
charts.value?.showToolTip(e);
|
|
98
98
|
}
|
|
99
|
+
|
|
100
|
+
const thas = ref<ComponentPublicInstance | null>();
|
|
101
|
+
async function getImage() {
|
|
102
|
+
if (props.canvas2d == false) {
|
|
103
|
+
return new Promise(resolve => {
|
|
104
|
+
uni.canvasToTempFilePath(
|
|
105
|
+
{
|
|
106
|
+
canvasId: canvasId.value,
|
|
107
|
+
success: res => {
|
|
108
|
+
resolve(res.tempFilePath);
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
thas.value
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
return new Promise(resolve => {
|
|
116
|
+
const query = uni.createSelectorQuery().in(thas.value);
|
|
117
|
+
query
|
|
118
|
+
.select('#' + canvasId.value)
|
|
119
|
+
.fields({ node: true, size: true })
|
|
120
|
+
.exec(res => {
|
|
121
|
+
if (res[0]) {
|
|
122
|
+
const canvas = res[0].node;
|
|
123
|
+
resolve(canvas.toDataURL('image/png'));
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
defineExpose({
|
|
130
|
+
getImage,
|
|
131
|
+
});
|
|
99
132
|
</script>
|
|
100
133
|
|
|
101
134
|
<style scoped></style>
|
|
@@ -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
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
---$
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 基础用法
|
|
8
8
|
|
|
9
9
|
- 属性`data`用于基础数据展示
|
|
10
10
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
## 倒计时
|
|
30
30
|
|
|
31
31
|
- 属性`endTime`用于设置倒计时结束时间
|
|
32
32
|
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</template>
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
## 按钮文字
|
|
53
53
|
|
|
54
54
|
- 属性`buttonText`用于设置按钮文字内容
|
|
55
55
|
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
</template>
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
## 禁用按钮
|
|
75
75
|
|
|
76
76
|
- 属性`buttonDisabled`禁用按钮
|
|
77
77
|
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
</template>
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
## 进度条
|
|
97
97
|
|
|
98
98
|
- 属性`progress`用于设置进度条值,0-100
|
|
99
99
|
- 属性`progressText`用于设置进度条文字内容
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</template>
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
## Position插槽
|
|
120
120
|
|
|
121
121
|
- 插槽`position`可以在任意位置插入内容
|
|
122
122
|
|
|
@@ -153,15 +153,7 @@
|
|
|
153
153
|
|
|
154
154
|
---$
|
|
155
155
|
|
|
156
|
-
### API
|
|
157
|
-
|
|
158
156
|
<!-- props -->
|
|
159
157
|
|
|
160
|
-
#### Slot
|
|
161
|
-
|
|
162
|
-
| 插槽名称 | 说明 | 支持版本 |
|
|
163
|
-
| ---------- | ------------------ | -------- |
|
|
164
|
-
| `position` | 在任意位置插入内容 | - |
|
|
165
|
-
|
|
166
158
|
---$
|
|
167
159
|
{{xuyajun}}
|
|
@@ -49,17 +49,36 @@
|
|
|
49
49
|
{
|
|
50
50
|
"name": "[event]buttonClick",
|
|
51
51
|
"description": "点击按钮时触发",
|
|
52
|
-
"
|
|
52
|
+
"params": [
|
|
53
|
+
{
|
|
54
|
+
"name": "data",
|
|
55
|
+
"description": "() => void"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
53
58
|
},
|
|
54
59
|
{
|
|
55
60
|
"name": "[event]footerClick",
|
|
56
61
|
"description": "点击页脚列表时触发",
|
|
57
|
-
"
|
|
62
|
+
"params": [
|
|
63
|
+
{
|
|
64
|
+
"name": "data",
|
|
65
|
+
"description": "(index:number) => void"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
58
68
|
},
|
|
59
69
|
{
|
|
60
70
|
"name": "[event]countDown",
|
|
61
71
|
"description": "倒计时触发",
|
|
62
|
-
"
|
|
72
|
+
"params": [
|
|
73
|
+
{
|
|
74
|
+
"name": "data",
|
|
75
|
+
"description": "(data:any,time:number) => void"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "[slot]position",
|
|
81
|
+
"description": "在任意位置插入内容"
|
|
63
82
|
}
|
|
64
83
|
]
|
|
65
84
|
}
|