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.
- 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 +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,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { useSlots, computed, type CSSProperties } from 'vue';
|
|
2
|
+
import { useSlots, computed, ref, watch, type CSSProperties } from 'vue';
|
|
3
3
|
import { useColorStore } from '../../store/color';
|
|
4
4
|
import utils from '../../utils/utils';
|
|
5
5
|
import propsData, { RADIO_KEY, type RadioEmits } from './props';
|
|
6
6
|
import type { RadioGroupProps } from '../ste-radio-group/props';
|
|
7
7
|
import { useInject } from '../../utils/mixin';
|
|
8
8
|
|
|
9
|
-
// 🚀
|
|
9
|
+
// 🚀 模块级别调用,所有实例共享
|
|
10
10
|
const { getColor } = useColorStore();
|
|
11
11
|
const themeColor = getColor()?.steThemeColor || '#0090FF';
|
|
12
12
|
|
|
@@ -23,135 +23,157 @@ const slots = useSlots();
|
|
|
23
23
|
|
|
24
24
|
const Parent = useInject<{ props: Required<RadioGroupProps>; updateValue: (value: string) => void }>(RADIO_KEY);
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
// 🚀 优化: 使用 watch 而非 computed,避免频繁依赖追踪
|
|
27
|
+
const parentData = ref<{ props: Required<RadioGroupProps>; updateValue: (value: string) => void } | null>(null);
|
|
28
|
+
|
|
29
|
+
watch(
|
|
30
|
+
() => Parent?.parent,
|
|
31
|
+
newParent => {
|
|
32
|
+
parentData.value = newParent || null;
|
|
33
|
+
},
|
|
34
|
+
{ immediate: true }
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
// 是否在 group 中
|
|
38
|
+
const inGroup = computed(() => !!parentData.value);
|
|
39
|
+
|
|
40
|
+
// ─── 各 prop 单独 computed,直接使用 parentData ──────────────────────────
|
|
41
|
+
|
|
42
|
+
const cmpDisabled = computed(() => props.disabled ?? parentData.value?.props.disabled ?? false);
|
|
43
|
+
const cmpReadonly = computed(() => props.readonly ?? parentData.value?.props.readonly ?? false);
|
|
44
|
+
const cmpShape = computed(() => props.shape ?? parentData.value?.props.shape ?? 'circle');
|
|
45
|
+
const cmpIconSize = computed(() => props.iconSize ?? parentData.value?.props.iconSize ?? 36);
|
|
46
|
+
const cmpCheckedColor = computed(() => props.checkedColor ?? parentData.value?.props.checkedColor ?? themeColor);
|
|
47
|
+
const cmpTextPosition = computed(() => props.textPosition ?? parentData.value?.props.textPosition ?? 'right');
|
|
48
|
+
const cmpTextSize = computed(() => props.textSize ?? parentData.value?.props.textSize ?? 28);
|
|
49
|
+
const cmpTextInactiveColor = computed(() => props.textInactiveColor ?? parentData.value?.props.textInactiveColor ?? '#000000');
|
|
50
|
+
const cmpTextActiveColor = computed(() => props.textActiveColor ?? parentData.value?.props.textActiveColor ?? '#000000');
|
|
51
|
+
const cmpTextDisabled = computed(() => props.textDisabled ?? parentData.value?.props.textDisabled ?? false);
|
|
52
|
+
const cmpMarginLeft = computed(() => props.marginLeft ?? parentData.value?.props.marginLeft ?? '0');
|
|
53
|
+
const cmpMarginRight = computed(() => props.marginRight ?? parentData.value?.props.marginRight ?? '0');
|
|
54
|
+
const cmpColumnGap = computed(() => props.columnGap ?? parentData.value?.props.columnGap ?? '16');
|
|
55
|
+
|
|
56
|
+
// ─── 选中状态 ───────────────────────────────────────────────────────────────
|
|
27
57
|
|
|
28
|
-
// 🚀 优化: 只保留必要的 computed
|
|
29
58
|
const cmpChecked = computed(() => {
|
|
30
|
-
|
|
59
|
+
if (inGroup.value) {
|
|
60
|
+
return parentData.value!.props.modelValue == props.name;
|
|
61
|
+
}
|
|
62
|
+
return props.modelValue == props.name;
|
|
31
63
|
});
|
|
32
64
|
|
|
33
|
-
//
|
|
34
|
-
const cmpRootStyle = computed(() => {
|
|
35
|
-
const textSize = getDefaultData('textSize', 28);
|
|
36
|
-
const textPosition = getDefaultData('textPosition', 'right');
|
|
37
|
-
const readonly = getDefaultData('readonly', false);
|
|
38
|
-
const disabled = getDefaultData('disabled', false);
|
|
39
|
-
const textDisabled = getDefaultData('textDisabled', false);
|
|
65
|
+
// ─── 根节点样式 ─────────────────────────────────────────────────────────────
|
|
40
66
|
|
|
67
|
+
const cmpRootStyle = computed(() => {
|
|
41
68
|
const style: CSSProperties = {
|
|
42
|
-
fontSize: `var(--font-size-${
|
|
43
|
-
color: cmpChecked.value ?
|
|
44
|
-
flexDirection:
|
|
45
|
-
marginLeft: utils.formatPx(
|
|
46
|
-
marginRight: utils.formatPx(
|
|
47
|
-
columnGap: utils.formatPx(
|
|
69
|
+
fontSize: `var(--font-size-${cmpTextSize.value},${utils.formatPx(cmpTextSize.value)})`,
|
|
70
|
+
color: cmpChecked.value ? cmpTextActiveColor.value : cmpTextInactiveColor.value,
|
|
71
|
+
flexDirection: cmpTextPosition.value === 'right' ? 'row' : 'row-reverse',
|
|
72
|
+
marginLeft: utils.formatPx(cmpMarginLeft.value),
|
|
73
|
+
marginRight: utils.formatPx(cmpMarginRight.value),
|
|
74
|
+
columnGap: slots.default ? utils.formatPx(cmpColumnGap.value) : '0',
|
|
48
75
|
};
|
|
49
76
|
|
|
50
77
|
// #ifdef H5
|
|
51
|
-
if (
|
|
78
|
+
if (cmpDisabled.value || cmpReadonly.value) {
|
|
52
79
|
style['cursor'] = 'not-allowed';
|
|
53
|
-
} else if (
|
|
80
|
+
} else if (cmpTextDisabled.value) {
|
|
54
81
|
style['cursor'] = 'default';
|
|
55
82
|
} else {
|
|
56
83
|
style['cursor'] = 'pointer';
|
|
57
84
|
}
|
|
58
85
|
// #endif
|
|
59
86
|
|
|
60
|
-
if (
|
|
87
|
+
if (cmpTextDisabled.value) {
|
|
61
88
|
style['pointerEvents'] = 'none';
|
|
62
89
|
}
|
|
63
90
|
return style;
|
|
64
91
|
});
|
|
65
92
|
|
|
66
|
-
|
|
67
|
-
const shape = getDefaultData('shape', 'circle');
|
|
68
|
-
const iconSize = getDefaultData('iconSize', 36);
|
|
69
|
-
const checkedColor = getDefaultData('checkedColor', themeColor);
|
|
70
|
-
const readonly = getDefaultData('readonly', false);
|
|
71
|
-
const disabled = getDefaultData('disabled', false);
|
|
72
|
-
const checked = cmpChecked.value;
|
|
93
|
+
// ─── 图标样式 ───────────────────────────────────────────────────────────────
|
|
73
94
|
|
|
95
|
+
const cmpInputStyle = computed(() => {
|
|
74
96
|
const style: CSSProperties = {
|
|
75
|
-
borderRadius:
|
|
76
|
-
border: `${utils.formatPx(2)} solid ${
|
|
77
|
-
background:
|
|
78
|
-
width: `var(--font-size-${
|
|
79
|
-
height: `var(--font-size-${
|
|
80
|
-
lineHeight: `var(--font-size-${
|
|
97
|
+
borderRadius: cmpShape.value === 'circle' ? '50%' : '0',
|
|
98
|
+
border: `${utils.formatPx(2)} solid ${cmpChecked.value ? cmpCheckedColor.value : '#BBBBBB'}`,
|
|
99
|
+
background: cmpChecked.value ? cmpCheckedColor.value : '#FFFFFF',
|
|
100
|
+
width: `var(--font-size-${cmpIconSize.value},${utils.formatPx(cmpIconSize.value)})`,
|
|
101
|
+
height: `var(--font-size-${cmpIconSize.value},${utils.formatPx(cmpIconSize.value)})`,
|
|
102
|
+
lineHeight: `var(--font-size-${cmpIconSize.value},${utils.formatPx(cmpIconSize.value)})`,
|
|
81
103
|
};
|
|
82
104
|
|
|
83
105
|
// #ifdef H5
|
|
84
|
-
style['cursor'] =
|
|
106
|
+
style['cursor'] = cmpDisabled.value || cmpReadonly.value ? 'not-allowed' : 'pointer';
|
|
85
107
|
// #endif
|
|
86
108
|
|
|
87
|
-
if (
|
|
109
|
+
if (cmpDisabled.value) {
|
|
88
110
|
style['background'] = '#eeeeee';
|
|
89
111
|
style['borderColor'] = '#bbbbbb';
|
|
90
112
|
}
|
|
91
|
-
|
|
92
|
-
// 在没有使用插槽内容时去掉边距
|
|
93
|
-
if (!slots.default) {
|
|
94
|
-
style['columnGap'] = '0';
|
|
95
|
-
}
|
|
96
113
|
return style;
|
|
97
114
|
});
|
|
98
115
|
|
|
99
|
-
//
|
|
116
|
+
// ─── slotProps & icon props ─────────────────────────────────────────────────
|
|
117
|
+
|
|
100
118
|
const cmpSlotProps = computed(() => ({
|
|
101
119
|
checked: cmpChecked.value,
|
|
102
|
-
disabled:
|
|
103
|
-
readonly:
|
|
120
|
+
disabled: cmpDisabled.value,
|
|
121
|
+
readonly: cmpReadonly.value,
|
|
104
122
|
}));
|
|
105
123
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return {
|
|
111
|
-
size: iconSize * 0.8,
|
|
112
|
-
color: disabled ? '#bbbbbb' : '#fff',
|
|
113
|
-
};
|
|
114
|
-
});
|
|
124
|
+
const cmpIconProps = computed(() => ({
|
|
125
|
+
size: (cmpIconSize.value as number) * 0.8,
|
|
126
|
+
color: cmpDisabled.value ? '#bbbbbb' : '#fff',
|
|
127
|
+
}));
|
|
115
128
|
|
|
116
|
-
|
|
117
|
-
const readonly = getDefaultData('readonly', false);
|
|
118
|
-
const disabled = getDefaultData('disabled', false);
|
|
119
|
-
|
|
120
|
-
if (!disabled && !readonly) {
|
|
121
|
-
let next = true;
|
|
122
|
-
const stop = new Promise((resolve, reject) => {
|
|
123
|
-
emits(
|
|
124
|
-
'click',
|
|
125
|
-
props.modelValue,
|
|
126
|
-
() => (next = false),
|
|
127
|
-
() => resolve(props.modelValue),
|
|
128
|
-
() => reject()
|
|
129
|
-
);
|
|
130
|
-
});
|
|
131
|
-
if (!next) {
|
|
132
|
-
try {
|
|
133
|
-
await stop;
|
|
134
|
-
} catch (e) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
129
|
+
// ─── 点击处理 ───────────────────────────────────────────────────────────────
|
|
138
130
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
131
|
+
// 🚀 优化: 移除 async,简化 Promise 处理
|
|
132
|
+
function click() {
|
|
133
|
+
if (cmpDisabled.value || cmpReadonly.value) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
let next = true;
|
|
138
|
+
const stop = new Promise<void>(resolve => {
|
|
139
|
+
emits(
|
|
140
|
+
'click',
|
|
141
|
+
props.modelValue,
|
|
142
|
+
() => (next = false),
|
|
143
|
+
() => resolve(),
|
|
144
|
+
() => {}
|
|
145
|
+
);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
if (!next) {
|
|
149
|
+
stop.catch(() => {});
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (!cmpChecked.value) {
|
|
154
|
+
let value = String(props.name);
|
|
155
|
+
if (inGroup.value) {
|
|
156
|
+
parentData.value!.updateValue(value);
|
|
157
|
+
} else {
|
|
158
|
+
emits('update:modelValue', value);
|
|
147
159
|
}
|
|
160
|
+
emits('change', value);
|
|
148
161
|
}
|
|
149
162
|
}
|
|
150
163
|
|
|
164
|
+
// ─── 工具函数(保留兼容)──────────────────────────────────────────────────────
|
|
165
|
+
|
|
151
166
|
type PropsKeyType = keyof typeof props;
|
|
167
|
+
/**
|
|
168
|
+
* 优先使用子组件自身 prop,否则读父组件 props,最后取默认值。
|
|
169
|
+
* 每个独立 computed 调用此函数,响应式系统会精准追踪对应字段。
|
|
170
|
+
*/
|
|
152
171
|
const getDefaultData = <T,>(key: PropsKeyType, defaultValue: T): T => {
|
|
153
172
|
const value = props[key];
|
|
154
|
-
|
|
173
|
+
if (value !== undefined && value !== null && value !== '') return value as T;
|
|
174
|
+
const parentVal = parentProps.value?.[key as keyof RadioGroupProps];
|
|
175
|
+
if (parentVal !== undefined && parentVal !== null && (parentVal as any) !== '') return parentVal as T;
|
|
176
|
+
return defaultValue;
|
|
155
177
|
};
|
|
156
178
|
</script>
|
|
157
179
|
|
|
@@ -165,10 +187,12 @@ const getDefaultData = <T,>(key: PropsKeyType, defaultValue: T): T => {
|
|
|
165
187
|
</slot>
|
|
166
188
|
</view>
|
|
167
189
|
<view class="text">
|
|
190
|
+
<!-- #ifndef MP -->
|
|
191
|
+
<slot :slotProps="cmpSlotProps"></slot>
|
|
192
|
+
<!-- #endif -->
|
|
168
193
|
<!-- #ifdef MP -->
|
|
169
194
|
<slot></slot>
|
|
170
195
|
<!-- #endif -->
|
|
171
|
-
<slot :slotProps="cmpSlotProps"></slot>
|
|
172
196
|
</view>
|
|
173
197
|
</view>
|
|
174
198
|
</template>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Props
|
|
2
4
|
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
5
|
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
6
|
| `modelValue` | 当前评分数(支持v-model双向绑定) | `Number` | `0` | - | - |
|
|
@@ -15,7 +17,9 @@
|
|
|
15
17
|
| `iconData` | 每个分值对应的图标code | `Array` | `() => []` | - | - |
|
|
16
18
|
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
### Events
|
|
19
21
|
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
20
22
|
| ----- | ----- | ------- | -------- |
|
|
21
|
-
| `change` | 当前分值变化时触发的事件 |
|
|
23
|
+
| `change` | 当前分值变化时触发的事件 | `data`:() => void | - |
|
|
24
|
+
|
|
25
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
---$
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 代码演示
|
|
8
8
|
|
|
9
9
|
JavaScript后面的演示代码中涉及到的变量和方法都使用本`javascript`代码
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ let value4 = ref(2.5);
|
|
|
18
18
|
let value5 = ref(2);
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## 基础用法
|
|
22
22
|
|
|
23
23
|
通过`value`属性,双向绑定,设置评分的值
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ let value5 = ref(2);
|
|
|
28
28
|
</template>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
## 自定义图标
|
|
32
32
|
|
|
33
33
|
- 通过`inactiveCode`属性,设置未选中的图标code,默认``。
|
|
34
34
|
- 通过`activeCode`属性,设置选中的图标code,默认``。
|
|
@@ -43,7 +43,7 @@ let value5 = ref(2);
|
|
|
43
43
|
</template>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
## 自定义样式
|
|
47
47
|
|
|
48
48
|
- 通过`inactiveColor`属性,设置未选中的颜色,默认`#dddddd`。
|
|
49
49
|
- 通过`activeColor`属性,设置选中的颜色,默认`#0090FF`。
|
|
@@ -56,7 +56,7 @@ let value5 = ref(2);
|
|
|
56
56
|
</template>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
## 只读
|
|
60
60
|
|
|
61
61
|
通过`readonly `属性,设置只读,不可切换评分,样式不置灰,可部分星, 默认`false`。
|
|
62
62
|
|
|
@@ -66,7 +66,7 @@ let value5 = ref(2);
|
|
|
66
66
|
</template>
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
## 禁用
|
|
70
70
|
|
|
71
71
|
通过`disabled`属性,设置禁用,不可切换评分,样式置灰,可部分星,默认`false`。
|
|
72
72
|
|
|
@@ -76,7 +76,7 @@ let value5 = ref(2);
|
|
|
76
76
|
</template>
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
## 自定义数量和自定义分值
|
|
80
80
|
|
|
81
81
|
- 通过`count`属性,设置图标总数,默认`5`。
|
|
82
82
|
- 通过`score`属性,设置每颗图标代表的分数,默认`1`。
|
|
@@ -88,7 +88,7 @@ let value5 = ref(2);
|
|
|
88
88
|
</template>
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
## 自定义分值图标
|
|
92
92
|
|
|
93
93
|
- 需要传入图标code对应的数组, 此时`inactiveColor`和`activeColor`将失效
|
|
94
94
|
- 会根据当前评分数对应的图标数量来取`iconData`中的值为当前图标的`code`
|
|
@@ -105,8 +105,6 @@ let value5 = ref(2);
|
|
|
105
105
|
|
|
106
106
|
---$
|
|
107
107
|
|
|
108
|
-
### API
|
|
109
|
-
|
|
110
108
|
<!-- props -->
|
|
111
109
|
|
|
112
110
|
---$
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Props
|
|
2
4
|
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
5
|
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
6
|
| `showHeight` | 需要折叠的高度 | `string / number` | `400` | - | - |
|
|
@@ -9,8 +11,22 @@
|
|
|
9
11
|
| `color` | 文本颜色 | `string` | `#666666` | - | - |
|
|
10
12
|
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
### Events
|
|
13
15
|
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
14
16
|
| ----- | ----- | ------- | -------- |
|
|
15
|
-
| `open` | 展开时触发 |
|
|
16
|
-
| `click` | 收起时触发 |
|
|
17
|
+
| `open` | 展开时触发 | `data`:() => void | - |
|
|
18
|
+
| `click` | 收起时触发 | `data`:() => void | - |
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Methods
|
|
22
|
+
| 方法名 | 说明 | 参数 | 返回值 | 支持版本 |
|
|
23
|
+
| ----- | ----- | --- | ------ | -------- |
|
|
24
|
+
| `init` | 重新初始化组件内部高度计算过程,如果是异步获取内容需要用到 | - | - | - |
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Slots
|
|
28
|
+
| 插槽名 | 说明 | 参数 | 支持版本 |
|
|
29
|
+
| ----- | ----- | --- | -------- |
|
|
30
|
+
| `default` | 单选框文本内容 | - | - |
|
|
31
|
+
|
|
32
|
+
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
---$
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 代码演示
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 基础使用
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
12
|
<template>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</script>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## 收起后展示按钮
|
|
25
25
|
|
|
26
26
|
```html
|
|
27
27
|
<template>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</script>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
## 提示文字
|
|
40
40
|
|
|
41
41
|
```html
|
|
42
42
|
<template>
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
</script>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
## 异步初始化
|
|
55
55
|
|
|
56
56
|
有时候需要展示的内容是从后端获取的,组件内部的`mounted`生命周期初始化时,请求尚未回来,会导致 内容的高度在初始化有误差。可以在请求完毕渲染后(指的是this.$nextTick),通过`ref`调用组件的`init`方法,重新初始化
|
|
57
57
|
|
|
@@ -83,21 +83,7 @@
|
|
|
83
83
|
|
|
84
84
|
---$
|
|
85
85
|
|
|
86
|
-
### API
|
|
87
|
-
|
|
88
86
|
<!-- props -->
|
|
89
87
|
|
|
90
|
-
#### Slots
|
|
91
|
-
|
|
92
|
-
| 插槽名 | 说明 | 插槽参数 | 支持版本 |
|
|
93
|
-
| --------- | -------------- | -------- | -------- |
|
|
94
|
-
| `default` | 单选框文本内容 | - | - |
|
|
95
|
-
|
|
96
|
-
#### Methods
|
|
97
|
-
|
|
98
|
-
| 方法名 | 说明 | 方法参数 | 支持版本 |
|
|
99
|
-
| ------ | ---------------------------------------------------------- | -------- | -------- |
|
|
100
|
-
| `init` | 重新初始化组件内部高度计算过程,如果是异步获取内容需要用到 | - | - |
|
|
101
|
-
|
|
102
88
|
---$
|
|
103
89
|
{{fuyuwei}}
|
|
@@ -43,12 +43,30 @@
|
|
|
43
43
|
{
|
|
44
44
|
"name": "[event]open",
|
|
45
45
|
"description": "展开时触发",
|
|
46
|
-
"
|
|
46
|
+
"params": [
|
|
47
|
+
{
|
|
48
|
+
"name": "data",
|
|
49
|
+
"description": "() => void"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
47
52
|
},
|
|
48
53
|
{
|
|
49
54
|
"name": "[event]click",
|
|
50
55
|
"description": "收起时触发",
|
|
51
|
-
"
|
|
56
|
+
"params": [
|
|
57
|
+
{
|
|
58
|
+
"name": "data",
|
|
59
|
+
"description": "() => void"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "[method]init",
|
|
65
|
+
"description": "重新初始化组件内部高度计算过程,如果是异步获取内容需要用到"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "[slot]default",
|
|
69
|
+
"description": "单选框文本内容"
|
|
52
70
|
}
|
|
53
71
|
]
|
|
54
72
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
---$
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 一张图片
|
|
8
8
|
|
|
9
9
|
```html
|
|
10
10
|
<template>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</template>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## 两张图片
|
|
16
16
|
|
|
17
17
|
```html
|
|
18
18
|
<template>
|
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
|
|
23
23
|
---$
|
|
24
24
|
|
|
25
|
-
### API
|
|
26
|
-
|
|
27
25
|
<!-- props -->
|
|
28
26
|
|
|
29
27
|
---$
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
---$
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 代码演示
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 默认配置
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
12
|
<template>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</script>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
## 默认颜色
|
|
30
30
|
|
|
31
31
|
- 属性`color`: `['#165DFF', '#14C9C9', '#F7BA1E', '#3491FA', '#722ED1', '#9FDB1D']`
|
|
32
32
|
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
</script>
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
## 副标题,标题+副标题
|
|
56
56
|
|
|
57
57
|
- 属性`subtitle`: 副标题对象
|
|
58
58
|
- 属性`title`: 标题对象
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
</script>
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
## 图例
|
|
80
80
|
|
|
81
81
|
- 属性`legend`: 图例对象
|
|
82
82
|
|
|
@@ -104,6 +104,23 @@
|
|
|
104
104
|
</script>
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
## 事件
|
|
108
|
+
|
|
109
|
+
- 属性`getImage`: 通过ref来获取实例的base64格式的图片地址,异步方法,需在实例生成后调用。
|
|
110
|
+
|
|
111
|
+
```html
|
|
112
|
+
<template>
|
|
113
|
+
<ste-ring-chart :series="series1" ref="ringChart"></ste-ring-chart>
|
|
114
|
+
</template>
|
|
115
|
+
<script setup lang="ts">
|
|
116
|
+
import { ref,onMounted } from 'vue';
|
|
117
|
+
let ringChart: any = ref(null);
|
|
118
|
+
onMounted(async () => {
|
|
119
|
+
const base64 = await ringChart.value.getImage()
|
|
120
|
+
}),
|
|
121
|
+
</script>
|
|
122
|
+
```
|
|
123
|
+
|
|
107
124
|
---$
|
|
108
125
|
|
|
109
126
|
<!-- props -->
|
|
@@ -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';
|
|
@@ -95,6 +95,45 @@ function tap(e: any) {
|
|
|
95
95
|
charts?.value.touchLegend(e);
|
|
96
96
|
charts?.value.showToolTip(e);
|
|
97
97
|
}
|
|
98
|
+
const thas = ref<ComponentPublicInstance | null>();
|
|
99
|
+
const emits = defineEmits<{
|
|
100
|
+
(e: 'getImage'): String;
|
|
101
|
+
}>();
|
|
102
|
+
|
|
103
|
+
async function getImage() {
|
|
104
|
+
console.log('getImage', props.canvas2d);
|
|
105
|
+
if (props.canvas2d == false) {
|
|
106
|
+
return new Promise(resolve => {
|
|
107
|
+
uni.canvasToTempFilePath(
|
|
108
|
+
{
|
|
109
|
+
canvasId: canvasId.value,
|
|
110
|
+
success: res => {
|
|
111
|
+
resolve(emits('getImage', res.tempFilePath));
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
thas.value
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
return new Promise(resolve => {
|
|
119
|
+
const query = uni.createSelectorQuery().in(thas.value);
|
|
120
|
+
query
|
|
121
|
+
.select('#' + canvasId.value)
|
|
122
|
+
.fields({ node: true, size: true })
|
|
123
|
+
.exec(res => {
|
|
124
|
+
console.log('res[0]', res[0].node.toDataURL('image/png'));
|
|
125
|
+
if (res[0]) {
|
|
126
|
+
const canvas = res[0].node;
|
|
127
|
+
emits('getImage', canvas.toDataURL('image/png'));
|
|
128
|
+
resolve(canvas.toDataURL('image/png'));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
defineExpose({
|
|
135
|
+
getImage,
|
|
136
|
+
});
|
|
98
137
|
</script>
|
|
99
138
|
|
|
100
139
|
<style scoped></style>
|