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