oxy-uni-ui 2.1.2 → 2.1.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/attributes.json +1 -1
- package/components/common/AbortablePromise.ts +4 -0
- package/components/common/abstracts/variable.scss +172 -66
- package/components/common/base64.ts +6 -0
- package/components/common/clickoutside.ts +5 -0
- package/components/common/interceptor.ts +9 -0
- package/components/common/path.ts +4 -0
- package/components/common/props.ts +23 -0
- package/components/common/util.ts +18 -1
- package/components/composables/index.ts +2 -0
- package/components/composables/useCell.ts +8 -1
- package/components/composables/useChildren.ts +27 -1
- package/components/composables/useCountDown.ts +10 -1
- package/components/composables/useDynamicVirtualScroll.ts +9 -0
- package/components/composables/useGlobalLoading.ts +6 -0
- package/components/composables/useGlobalMessage.ts +6 -0
- package/components/composables/useGlobalToast.ts +6 -0
- package/components/composables/useLockScroll.ts +9 -0
- package/components/composables/useParent.ts +65 -14
- package/components/composables/usePopover.ts +9 -0
- package/components/composables/useQueue.ts +8 -0
- package/components/composables/useRaf.ts +10 -0
- package/components/composables/useSharedState.ts +284 -0
- package/components/composables/useTouch.ts +8 -0
- package/components/composables/useTranslate.ts +9 -0
- package/components/composables/useUpload.ts +83 -11
- package/components/composables/useVirtualScroll.ts +7 -0
- package/components/composables/useWindowResize.ts +9 -0
- package/components/oxy-action-sheet/index.scss +5 -5
- package/components/oxy-action-sheet/oxy-action-sheet.vue +11 -0
- package/components/oxy-backtop/index.scss +2 -2
- package/components/oxy-backtop/oxy-backtop.vue +2 -0
- package/components/oxy-badge/oxy-badge.vue +2 -0
- package/components/oxy-badge/types.ts +3 -0
- package/components/oxy-button/index.scss +13 -13
- package/components/oxy-button/oxy-button.vue +11 -0
- package/components/oxy-button/types.ts +3 -3
- package/components/oxy-calendar/index.scss +17 -17
- package/components/oxy-calendar/oxy-calendar.vue +31 -0
- package/components/oxy-calendar/types.ts +3 -0
- package/components/oxy-calendar-view/month/month.vue +2 -0
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +3 -1
- package/components/oxy-calendar-view/monthPanel/types.ts +10 -7
- package/components/oxy-calendar-view/oxy-calendar-view.vue +2 -0
- package/components/oxy-calendar-view/types.ts +3 -1
- package/components/oxy-calendar-view/year/types.ts +33 -1
- package/components/oxy-calendar-view/year/year.vue +2 -0
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +2 -0
- package/components/oxy-card/index.scss +1 -1
- package/components/oxy-card/oxy-card.vue +2 -0
- package/components/oxy-cell/index.scss +3 -1
- package/components/oxy-cell/oxy-cell.vue +6 -4
- package/components/oxy-cell-group/oxy-cell-group.vue +2 -0
- package/components/oxy-checkbox/index.scss +7 -7
- package/components/oxy-checkbox/oxy-checkbox.vue +22 -16
- package/components/oxy-checkbox/types.ts +9 -0
- package/components/oxy-checkbox-group/index.scss +1 -1
- package/components/oxy-checkbox-group/oxy-checkbox-group.vue +2 -0
- package/components/oxy-circle/oxy-circle.vue +2 -0
- package/components/oxy-col/oxy-col.vue +3 -1
- package/components/oxy-col-picker/index.scss +3 -3
- package/components/oxy-col-picker/oxy-col-picker.vue +17 -1
- package/components/oxy-col-picker/types.ts +3 -0
- package/components/oxy-collapse/index.scss +2 -2
- package/components/oxy-collapse/oxy-collapse.vue +9 -0
- package/components/oxy-collapse-item/oxy-collapse-item.vue +4 -2
- package/components/oxy-config-provider/oxy-config-provider.vue +18 -0
- package/components/oxy-config-provider/types.ts +18 -0
- package/components/oxy-corner/index.scss +50 -32
- package/components/oxy-corner/oxy-corner.vue +2 -0
- package/components/oxy-count-down/oxy-count-down.vue +2 -0
- package/components/oxy-count-to/oxy-count-to.vue +12 -1
- package/components/oxy-count-to/types.ts +14 -4
- package/components/oxy-curtain/index.scss +10 -9
- package/components/oxy-curtain/oxy-curtain.vue +2 -0
- package/components/oxy-date-strip/oxy-date-strip.vue +22 -1
- package/components/oxy-date-strip-item/index.scss +4 -4
- package/components/oxy-date-strip-item/oxy-date-strip-item.vue +2 -0
- package/components/oxy-datetime-picker/index.scss +3 -3
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +11 -1
- package/components/oxy-datetime-picker-view/oxy-datetime-picker-view.vue +2 -0
- package/components/oxy-divider/oxy-divider.vue +2 -0
- package/components/oxy-drop-menu/index.scss +2 -2
- package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -0
- package/components/oxy-drop-menu-item/index.scss +1 -1
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +17 -9
- package/components/oxy-echarts/oxy-echarts.vue +2 -0
- package/components/oxy-fab/index.scss +1 -1
- package/components/oxy-fab/oxy-fab.vue +27 -0
- package/components/oxy-file-list/index.scss +9 -9
- package/components/oxy-file-list/oxy-file-list.vue +29 -17
- package/components/oxy-floating-panel/oxy-floating-panel.vue +34 -10
- package/components/oxy-footer/index.scss +7 -0
- package/components/oxy-footer/oxy-footer.vue +4 -2
- package/components/oxy-footer/types.ts +9 -6
- package/components/oxy-form/oxy-form.vue +13 -1
- package/components/oxy-form-item/oxy-form-item.vue +5 -3
- package/components/oxy-gap/oxy-gap.vue +2 -0
- package/components/oxy-global-loading/oxy-global-loading.vue +18 -5
- package/components/oxy-global-message/oxy-global-message.vue +30 -17
- package/components/oxy-global-toast/oxy-global-toast.vue +18 -5
- package/components/oxy-grid/oxy-grid.vue +6 -0
- package/components/oxy-grid-item/index.scss +1 -1
- package/components/oxy-grid-item/oxy-grid-item.vue +22 -20
- package/components/oxy-guidance/index.scss +9 -9
- package/components/oxy-guidance/oxy-guidance.vue +22 -16
- package/components/oxy-icon/oxy-icon.vue +2 -0
- package/components/oxy-icon/types.ts +3 -0
- package/components/oxy-image-preview/index.scss +75 -0
- package/components/oxy-image-preview/index.ts +56 -0
- package/components/oxy-image-preview/oxy-image-preview.vue +221 -0
- package/components/oxy-image-preview/types.ts +164 -0
- package/components/oxy-img/oxy-img.vue +2 -0
- package/components/oxy-img-cropper/index.scss +2 -2
- package/components/oxy-img-cropper/oxy-img-cropper.vue +6 -0
- package/components/oxy-img-lazy/oxy-img-lazy.vue +9 -0
- package/components/oxy-index-anchor/index.scss +1 -1
- package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
- package/components/oxy-index-bar/index.scss +1 -1
- package/components/oxy-index-bar/oxy-index-bar.vue +18 -0
- package/components/oxy-input/index.scss +2 -1
- package/components/oxy-input/oxy-input.vue +18 -4
- package/components/oxy-input/types.ts +6 -0
- package/components/oxy-input-number/index.scss +3 -1
- package/components/oxy-input-number/oxy-input-number.vue +2 -0
- package/components/oxy-keyboard/index.scss +3 -3
- package/components/oxy-keyboard/key/index.vue +2 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +11 -2
- package/components/oxy-link/index.scss +8 -4
- package/components/oxy-link/oxy-link.vue +9 -3
- package/components/oxy-link/types.ts +2 -2
- package/components/oxy-list/oxy-list.vue +2 -0
- package/components/oxy-list/types.ts +7 -0
- package/components/oxy-loading/oxy-loading.vue +6 -0
- package/components/oxy-loadmore/index.scss +1 -1
- package/components/oxy-loadmore/oxy-loadmore.vue +2 -0
- package/components/oxy-long-press-menu/index.scss +1 -1
- package/components/oxy-long-press-menu/oxy-long-press-menu.vue +42 -13
- package/components/oxy-message-box/index.scss +223 -36
- package/components/oxy-message-box/index.ts +49 -23
- package/components/oxy-message-box/oxy-message-box.vue +181 -56
- package/components/oxy-message-box/types.ts +60 -2
- package/components/oxy-navbar/index.scss +1 -1
- package/components/oxy-navbar/oxy-navbar.vue +9 -6
- package/components/oxy-navbar-capsule/oxy-navbar-capsule.vue +2 -0
- package/components/oxy-notice-bar/index.scss +1 -1
- package/components/oxy-notice-bar/oxy-notice-bar.vue +29 -0
- package/components/oxy-notify/index.ts +16 -12
- package/components/oxy-notify/oxy-notify.vue +11 -4
- package/components/oxy-overlay/oxy-overlay.vue +34 -2
- package/components/oxy-pagination/oxy-pagination.vue +2 -0
- package/components/oxy-password-input/oxy-password-input.vue +2 -0
- package/components/oxy-picker/index.scss +7 -7
- package/components/oxy-picker/oxy-picker.vue +11 -0
- package/components/oxy-picker-view/index.scss +1 -1
- package/components/oxy-picker-view/oxy-picker-view.vue +2 -0
- package/components/oxy-popover/index.scss +2 -2
- package/components/oxy-popover/oxy-popover.vue +4 -1
- package/components/oxy-popup/oxy-popup.vue +8 -0
- package/components/oxy-progress/index.scss +2 -2
- package/components/oxy-progress/oxy-progress.vue +7 -0
- package/components/oxy-qrcode/draw.ts +15 -1
- package/components/oxy-qrcode/oxy-qrcode.vue +10 -3
- package/components/oxy-radio/index.scss +8 -8
- package/components/oxy-radio/oxy-radio.vue +13 -11
- package/components/oxy-radio-group/index.scss +1 -1
- package/components/oxy-radio-group/oxy-radio-group.vue +2 -0
- package/components/oxy-rate/oxy-rate.vue +5 -0
- package/components/oxy-rate/types.ts +2 -2
- package/components/oxy-resize/oxy-resize.vue +12 -0
- package/components/oxy-rich-text/index.scss +9 -9
- package/components/oxy-rich-text/oxy-rich-text.vue +6 -0
- package/components/oxy-rich-text/types.ts +15 -0
- package/components/oxy-root-portal/oxy-root-portal.vue +23 -15
- package/components/oxy-row/oxy-row.vue +2 -0
- package/components/oxy-search/index.scss +3 -3
- package/components/oxy-search/oxy-search.vue +19 -0
- package/components/oxy-segmented/index.scss +4 -4
- package/components/oxy-segmented/oxy-segmented.vue +2 -0
- package/components/oxy-select/index.scss +25 -25
- package/components/oxy-select/oxy-select.vue +27 -0
- package/components/oxy-select/types.ts +3 -0
- package/components/oxy-select-picker/index.scss +5 -5
- package/components/oxy-select-picker/oxy-select-picker.vue +7 -0
- package/components/oxy-sidebar/oxy-sidebar.vue +2 -0
- package/components/oxy-sidebar-item/index.scss +3 -3
- package/components/oxy-sidebar-item/oxy-sidebar-item.vue +17 -31
- package/components/oxy-signature/oxy-signature.vue +17 -0
- package/components/oxy-skeleton/oxy-skeleton.vue +7 -1
- package/components/oxy-slide-verify/index.scss +95 -0
- package/components/oxy-slide-verify/oxy-slide-verify.vue +244 -0
- package/components/oxy-slide-verify/types.ts +98 -0
- package/components/oxy-slider/oxy-slider.vue +3 -0
- package/components/oxy-sort-button/index.scss +10 -8
- package/components/oxy-sort-button/oxy-sort-button.vue +6 -0
- package/components/oxy-splitter/index.scss +9 -0
- package/components/oxy-splitter/oxy-splitter.vue +23 -2
- package/components/oxy-splitter-panel/index.scss +7 -5
- package/components/oxy-splitter-panel/oxy-splitter-panel.vue +93 -89
- package/components/oxy-status-tip/index.scss +3 -3
- package/components/oxy-status-tip/oxy-status-tip.vue +2 -0
- package/components/oxy-step/index.scss +4 -4
- package/components/oxy-step/oxy-step.vue +15 -13
- package/components/oxy-steps/oxy-steps.vue +2 -0
- package/components/oxy-sticky/oxy-sticky.vue +5 -3
- package/components/oxy-stream-render/oxy-stream-render.vue +29 -0
- package/components/oxy-swipe-action/oxy-swipe-action.vue +8 -0
- package/components/oxy-swiper/oxy-swiper.vue +6 -0
- package/components/oxy-swiper-nav/index.scss +4 -4
- package/components/oxy-switch/index.scss +6 -3
- package/components/oxy-switch/oxy-switch.vue +10 -0
- package/components/oxy-tab/index.scss +1 -7
- package/components/oxy-tab/oxy-tab.vue +12 -10
- package/components/oxy-tabbar/oxy-tabbar.vue +5 -0
- package/components/oxy-tabbar-item/oxy-tabbar-item.vue +11 -9
- package/components/oxy-table/index.scss +1 -1
- package/components/oxy-table/oxy-table.vue +8 -0
- package/components/oxy-table/types.ts +3 -0
- package/components/oxy-table-col/oxy-table-col.vue +21 -19
- package/components/oxy-tabs/index.scss +11 -11
- package/components/oxy-tabs/oxy-tabs.vue +17 -0
- package/components/oxy-tag/index.scss +24 -5
- package/components/oxy-tag/oxy-tag.vue +17 -2
- package/components/oxy-tag/types.ts +7 -0
- package/components/oxy-text/oxy-text.vue +12 -1
- package/components/oxy-textarea/index.scss +3 -2
- package/components/oxy-textarea/oxy-textarea.vue +10 -4
- package/components/oxy-toast/index.ts +21 -20
- package/components/oxy-toast/oxy-toast.vue +30 -5
- package/components/oxy-toast/types.ts +20 -9
- package/components/oxy-tooltip/index.scss +1 -1
- package/components/oxy-tooltip/oxy-tooltip.vue +2 -0
- package/components/oxy-transition/index.scss +3 -1
- package/components/oxy-transition/oxy-transition.vue +14 -0
- package/components/oxy-tree/index.scss +3 -3
- package/components/oxy-tree/oxy-tree.vue +28 -5
- package/components/oxy-tree/types.ts +57 -1
- package/components/oxy-upload/index.scss +9 -9
- package/components/oxy-upload/oxy-upload.vue +5 -3
- package/components/oxy-verification-code/oxy-verification-code.vue +24 -0
- package/components/oxy-video-preview/index.scss +12 -7
- package/components/oxy-video-preview/index.ts +64 -0
- package/components/oxy-video-preview/oxy-video-preview.vue +102 -31
- package/components/oxy-video-preview/types.ts +54 -8
- package/components/oxy-virtual-scroll/index.scss +1 -1
- package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +2 -0
- package/components/oxy-voice-player/index.scss +64 -64
- package/components/oxy-voice-player/oxy-voice-player.vue +38 -10
- package/components/oxy-waterfall/oxy-waterfall.vue +13 -0
- package/components/oxy-waterfall/types.ts +7 -0
- package/components/oxy-waterfall-item/oxy-waterfall-item.vue +9 -0
- package/components/oxy-watermark/oxy-watermark.vue +2 -0
- package/global.d.ts +2 -0
- package/index.ts +2 -0
- package/locale/lang/en-US.ts +51 -2
- package/locale/lang/zh-CN.ts +51 -2
- package/package.json +2 -2
- package/styles/all.scss +125 -0
- package/tags.json +1 -1
- package/vite-plugins/vite-plugin-host-class.ts +166 -0
- package/web-types.json +1 -1
|
@@ -37,7 +37,9 @@ export default {
|
|
|
37
37
|
name: 'oxy-checkbox',
|
|
38
38
|
options: {
|
|
39
39
|
addGlobalClass: true,
|
|
40
|
+
// #ifndef MP-TOUTIAO
|
|
40
41
|
virtualHost: true,
|
|
42
|
+
// #endif
|
|
41
43
|
styleIsolation: 'shared'
|
|
42
44
|
}
|
|
43
45
|
}
|
|
@@ -61,8 +63,8 @@ defineExpose<CheckboxExpose>({
|
|
|
61
63
|
const { parent: checkboxGroup, index } = useParent(CHECKBOX_GROUP_KEY)
|
|
62
64
|
|
|
63
65
|
const isChecked = computed(() => {
|
|
64
|
-
if (checkboxGroup) {
|
|
65
|
-
return checkboxGroup.props.modelValue.indexOf(props.modelValue) > -1
|
|
66
|
+
if (checkboxGroup.value) {
|
|
67
|
+
return checkboxGroup.value.props.modelValue.indexOf(props.modelValue) > -1
|
|
66
68
|
} else {
|
|
67
69
|
return props.modelValue === props.trueValue
|
|
68
70
|
}
|
|
@@ -73,7 +75,7 @@ const isFirst = computed(() => {
|
|
|
73
75
|
})
|
|
74
76
|
|
|
75
77
|
const isLast = computed(() => {
|
|
76
|
-
const children = isDef(checkboxGroup) ? checkboxGroup.children : []
|
|
78
|
+
const children = isDef(checkboxGroup.value) ? checkboxGroup.value.children : []
|
|
77
79
|
return index.value === children.length - 1
|
|
78
80
|
})
|
|
79
81
|
const { proxy } = getCurrentInstance() as any
|
|
@@ -82,7 +84,7 @@ watch(
|
|
|
82
84
|
() => props.modelValue,
|
|
83
85
|
() => {
|
|
84
86
|
// 组合使用走这个逻辑
|
|
85
|
-
if (checkboxGroup) {
|
|
87
|
+
if (checkboxGroup.value) {
|
|
86
88
|
checkName()
|
|
87
89
|
}
|
|
88
90
|
}
|
|
@@ -97,18 +99,22 @@ watch(
|
|
|
97
99
|
)
|
|
98
100
|
|
|
99
101
|
const innerShape = computed(() => {
|
|
100
|
-
return props.shape || getPropByPath(checkboxGroup, 'props.shape') || 'circle'
|
|
102
|
+
return props.shape || getPropByPath(checkboxGroup.value, 'props.shape') || 'circle'
|
|
101
103
|
})
|
|
102
104
|
|
|
103
105
|
const innerCheckedColor = computed(() => {
|
|
104
|
-
return props.checkedColor || getPropByPath(checkboxGroup, 'props.checkedColor')
|
|
106
|
+
return props.checkedColor || getPropByPath(checkboxGroup.value, 'props.checkedColor')
|
|
105
107
|
})
|
|
106
108
|
|
|
109
|
+
/**
|
|
110
|
+
* 计算是否禁用。
|
|
111
|
+
* 分组模式下受 max/min 限制:已超过上限时未选中项禁用,低于下限时已选中项禁用
|
|
112
|
+
*/
|
|
107
113
|
const innerDisabled = computed(() => {
|
|
108
|
-
if (!checkboxGroup) {
|
|
114
|
+
if (!checkboxGroup.value) {
|
|
109
115
|
return props.disabled
|
|
110
116
|
}
|
|
111
|
-
const { max, min, modelValue, disabled } = checkboxGroup.props
|
|
117
|
+
const { max, min, modelValue, disabled } = checkboxGroup.value.props
|
|
112
118
|
if (
|
|
113
119
|
(max && modelValue.length >= max && !isChecked.value) ||
|
|
114
120
|
(min && modelValue.length <= min && isChecked.value) ||
|
|
@@ -122,15 +128,15 @@ const innerDisabled = computed(() => {
|
|
|
122
128
|
})
|
|
123
129
|
|
|
124
130
|
const innerInline = computed(() => {
|
|
125
|
-
return getPropByPath(checkboxGroup, 'props.inline') || false
|
|
131
|
+
return getPropByPath(checkboxGroup.value, 'props.inline') || false
|
|
126
132
|
})
|
|
127
133
|
|
|
128
134
|
const innerCell = computed(() => {
|
|
129
|
-
return getPropByPath(checkboxGroup, 'props.cell') || false
|
|
135
|
+
return getPropByPath(checkboxGroup.value, 'props.cell') || false
|
|
130
136
|
})
|
|
131
137
|
|
|
132
138
|
const innerSize = computed(() => {
|
|
133
|
-
return props.size || getPropByPath(checkboxGroup, 'props.size')
|
|
139
|
+
return props.size || getPropByPath(checkboxGroup.value, 'props.size')
|
|
134
140
|
})
|
|
135
141
|
|
|
136
142
|
onBeforeMount(() => {
|
|
@@ -144,9 +150,9 @@ onBeforeMount(() => {
|
|
|
144
150
|
* @param myName 自己的标识符
|
|
145
151
|
*/
|
|
146
152
|
function checkName() {
|
|
147
|
-
checkboxGroup &&
|
|
148
|
-
checkboxGroup.children &&
|
|
149
|
-
checkboxGroup.children.forEach((child: any) => {
|
|
153
|
+
checkboxGroup.value &&
|
|
154
|
+
checkboxGroup.value.children &&
|
|
155
|
+
checkboxGroup.value.children.forEach((child: any) => {
|
|
150
156
|
if (child.$.uid !== proxy.$.uid && child.modelValue === props.modelValue) {
|
|
151
157
|
console.error(`The checkbox's bound value: ${props.modelValue} has been used`)
|
|
152
158
|
}
|
|
@@ -158,11 +164,11 @@ function checkName() {
|
|
|
158
164
|
function toggle() {
|
|
159
165
|
if (innerDisabled.value) return
|
|
160
166
|
// 复选框单独使用时点击反选,并且在checkbox上触发change事件
|
|
161
|
-
if (checkboxGroup) {
|
|
167
|
+
if (checkboxGroup.value) {
|
|
162
168
|
emit('change', {
|
|
163
169
|
value: !isChecked.value
|
|
164
170
|
})
|
|
165
|
-
checkboxGroup.changeSelectState(props.modelValue)
|
|
171
|
+
checkboxGroup.value.changeSelectState(props.modelValue)
|
|
166
172
|
} else {
|
|
167
173
|
const newVal = props.modelValue === props.trueValue ? props.falseValue : props.trueValue
|
|
168
174
|
emit('update:modelValue', newVal)
|
|
@@ -5,7 +5,13 @@ export type CheckShape = 'circle' | 'square' | 'button'
|
|
|
5
5
|
|
|
6
6
|
export const checkboxProps = {
|
|
7
7
|
...baseProps,
|
|
8
|
+
/**
|
|
9
|
+
* label 外部自定义样式
|
|
10
|
+
*/
|
|
8
11
|
customLabelClass: makeStringProp(''),
|
|
12
|
+
/**
|
|
13
|
+
* shape 外部自定义样式
|
|
14
|
+
*/
|
|
9
15
|
customShapeClass: makeStringProp(''),
|
|
10
16
|
/**
|
|
11
17
|
* 单选框选中时的值
|
|
@@ -15,6 +21,9 @@ export const checkboxProps = {
|
|
|
15
21
|
required: true,
|
|
16
22
|
default: false
|
|
17
23
|
},
|
|
24
|
+
/**
|
|
25
|
+
* 是否为半选状态
|
|
26
|
+
*/
|
|
18
27
|
indeterminate: makeBooleanProp(false),
|
|
19
28
|
/**
|
|
20
29
|
* 单选框形状,可选值:circle / square / button
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// 顶部与两侧留白适当放大,避免按钮组在16px基准字号下过于紧凑
|
|
13
13
|
@include when(button) {
|
|
14
14
|
width: 100%;
|
|
15
|
-
padding:
|
|
15
|
+
padding: $-cell-wrapper-padding $-cell-padding $-spacing-32 $-cell-padding;
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
overflow: hidden;
|
|
18
18
|
height: auto;
|
|
@@ -9,7 +9,9 @@ export default {
|
|
|
9
9
|
name: 'oxy-col',
|
|
10
10
|
options: {
|
|
11
11
|
addGlobalClass: true,
|
|
12
|
+
// #ifndef MP-TOUTIAO
|
|
12
13
|
virtualHost: true,
|
|
14
|
+
// #endif
|
|
13
15
|
styleIsolation: 'shared'
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -26,7 +28,7 @@ const props = defineProps(colProps)
|
|
|
26
28
|
const { parent: row } = useParent(ROW_KEY)
|
|
27
29
|
|
|
28
30
|
const rootStyle = computed(() => {
|
|
29
|
-
const gutter = isDef(row) ? row.props.gutter || 0 : 0
|
|
31
|
+
const gutter = isDef(row.value) ? row.value.props.gutter || 0 : 0
|
|
30
32
|
const padding = withDefaultUnit(gutter / 2)
|
|
31
33
|
const style = gutter > 0 ? `padding-left: ${padding}; padding-right: ${padding};background-clip: content-box;` : ''
|
|
32
34
|
return `${style}${props.customStyle}`
|
|
@@ -141,18 +141,18 @@
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
@include e(list-item-tip) {
|
|
144
|
-
margin-top:
|
|
144
|
+
margin-top: $-spacing-8;
|
|
145
145
|
font-size: $-col-picker-list-fs-tip;
|
|
146
146
|
color: $-col-picker-list-color-tip;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
@include e(confirm) {
|
|
150
|
-
padding:
|
|
150
|
+
padding: $-spacing-24 $-spacing-48 $-spacing-32;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
@include edeep(checked) {
|
|
154
154
|
display: block;
|
|
155
|
-
margin-left:
|
|
155
|
+
margin-left: $-spacing-8;
|
|
156
156
|
font-size: $-col-picker-list-checked-icon-size;
|
|
157
157
|
color: $-col-picker-list-color-checked;
|
|
158
158
|
opacity: 0;
|
|
@@ -95,7 +95,9 @@ export default {
|
|
|
95
95
|
name: 'oxy-col-picker',
|
|
96
96
|
options: {
|
|
97
97
|
addGlobalClass: true,
|
|
98
|
+
// #ifndef MP-TOUTIAO
|
|
98
99
|
virtualHost: true,
|
|
100
|
+
// #endif
|
|
99
101
|
styleIsolation: 'shared'
|
|
100
102
|
}
|
|
101
103
|
}
|
|
@@ -343,6 +345,16 @@ function chooseItem(colIndex: number, index: number, triggerColChange: boolean =
|
|
|
343
345
|
}
|
|
344
346
|
}
|
|
345
347
|
|
|
348
|
+
/**
|
|
349
|
+
* 列切换回调,触发异步加载下一列数据。
|
|
350
|
+
* columnChange 提供 resolve(nextColumn) 加载下一列数据、finish(isOk) 结束选择:
|
|
351
|
+
* - resolve:更新 selectList 中 colIndex+1 列的数据并切换到该列
|
|
352
|
+
* - finish:结合 beforeConfirm 完成确认或回退
|
|
353
|
+
* @param colIndex - 当前列索引
|
|
354
|
+
* @param item - 当前选中项
|
|
355
|
+
* @param index - 选中项在列中的行索引
|
|
356
|
+
* @param callback - 额外的回调(用于自动补齐完成后的清理工作)
|
|
357
|
+
*/
|
|
346
358
|
function handleColChange(colIndex: number, item: Record<string, any>, index: number, callback?: () => void) {
|
|
347
359
|
loading.value = true
|
|
348
360
|
const { columnChange, beforeConfirm } = props
|
|
@@ -490,7 +502,11 @@ function lineScrollIntoView() {
|
|
|
490
502
|
.catch(() => {})
|
|
491
503
|
}
|
|
492
504
|
|
|
493
|
-
|
|
505
|
+
/**
|
|
506
|
+
* 递归补齐列数据。当 modelValue 长度超过已加载的 columns 时,
|
|
507
|
+
* 从缺失列开始逐级触发 columnChange,直到补齐所有列。
|
|
508
|
+
* @param colIndex - 起始列索引(-1 表示从第一列开始补齐)
|
|
509
|
+
*/
|
|
494
510
|
function diffColumns(colIndex: number) {
|
|
495
511
|
// colIndex 为 -1 时,item 为空对象,>=0 时则具有 value 属性
|
|
496
512
|
const item = colIndex === -1 ? {} : { [props.valueKey]: props.modelValue[colIndex] }
|
|
@@ -149,6 +149,9 @@ export const colPickerProps = {
|
|
|
149
149
|
* value 外部自定义样式
|
|
150
150
|
*/
|
|
151
151
|
customLabelClass: makeStringProp(''),
|
|
152
|
+
/**
|
|
153
|
+
* value 外部自定义样式
|
|
154
|
+
*/
|
|
152
155
|
customValueClass: makeStringProp(''),
|
|
153
156
|
/**
|
|
154
157
|
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
@include e(more-txt) {
|
|
39
39
|
display: inline-block;
|
|
40
40
|
vertical-align: middle;
|
|
41
|
-
margin-right:
|
|
41
|
+
margin-right: $-collapse-arrow-margin;
|
|
42
42
|
}
|
|
43
43
|
@include e(arrow) {
|
|
44
44
|
display: inline-block;
|
|
45
45
|
vertical-align: middle;
|
|
46
|
-
transition: transform
|
|
46
|
+
transition: transform $-transition-duration-fast;
|
|
47
47
|
font-size: $-collapse-arrow-size;
|
|
48
48
|
height: $-collapse-arrow-size;
|
|
49
49
|
line-height: $-collapse-arrow-size;
|
|
@@ -34,7 +34,9 @@ export default {
|
|
|
34
34
|
name: 'oxy-collapse',
|
|
35
35
|
options: {
|
|
36
36
|
addGlobalClass: true,
|
|
37
|
+
// #ifndef MP-TOUTIAO
|
|
37
38
|
virtualHost: true,
|
|
39
|
+
// #endif
|
|
38
40
|
styleIsolation: 'shared'
|
|
39
41
|
}
|
|
40
42
|
}
|
|
@@ -94,6 +96,13 @@ function updateChange(activeNames: string | string[] | boolean) {
|
|
|
94
96
|
})
|
|
95
97
|
}
|
|
96
98
|
|
|
99
|
+
/**
|
|
100
|
+
* 切换单个面板展开/收起。
|
|
101
|
+
* 手风琴模式:同一时间仅一个面板展开,再次点击收起。
|
|
102
|
+
* 普通模式:在 modelValue 数组中添加或移除面板 name。
|
|
103
|
+
* @param name - 面板名称
|
|
104
|
+
* @param expanded - 当前面板是否已展开
|
|
105
|
+
*/
|
|
97
106
|
function toggle(name: string, expanded: boolean) {
|
|
98
107
|
const { accordion, modelValue } = props
|
|
99
108
|
if (accordion) {
|
|
@@ -23,7 +23,9 @@ export default {
|
|
|
23
23
|
name: 'oxy-collapse-item',
|
|
24
24
|
options: {
|
|
25
25
|
addGlobalClass: true,
|
|
26
|
+
// #ifndef MP-TOUTIAO
|
|
26
27
|
virtualHost: true,
|
|
28
|
+
// #endif
|
|
27
29
|
styleIsolation: 'shared'
|
|
28
30
|
}
|
|
29
31
|
}
|
|
@@ -75,7 +77,7 @@ const contentStyle = computed(() => {
|
|
|
75
77
|
* 是否选中
|
|
76
78
|
*/
|
|
77
79
|
const isSelected = computed(() => {
|
|
78
|
-
const modelValue = collapse ? collapse?.props.modelValue || [] : []
|
|
80
|
+
const modelValue = collapse.value ? collapse.value?.props.modelValue || [] : []
|
|
79
81
|
const { name } = props
|
|
80
82
|
return (isString(modelValue) && modelValue === name) || (isArray(modelValue) && modelValue.indexOf(name as string) >= 0)
|
|
81
83
|
})
|
|
@@ -130,7 +132,7 @@ async function handleClick() {
|
|
|
130
132
|
try {
|
|
131
133
|
await updateExpand()
|
|
132
134
|
const { name } = props
|
|
133
|
-
collapse && collapse.toggle(name, !expanded.value)
|
|
135
|
+
collapse.value && collapse.value.toggle(name, !expanded.value)
|
|
134
136
|
} catch (error) {
|
|
135
137
|
/* empty */
|
|
136
138
|
}
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
export default {
|
|
9
9
|
name: 'oxy-config-provider',
|
|
10
10
|
options: {
|
|
11
|
+
// #ifndef MP-TOUTIAO
|
|
11
12
|
virtualHost: true,
|
|
13
|
+
// #endif
|
|
12
14
|
addGlobalClass: true,
|
|
13
15
|
styleIsolation: 'shared'
|
|
14
16
|
}
|
|
@@ -31,10 +33,20 @@ const themeStyle = computed(() => {
|
|
|
31
33
|
return styleObj ? `${objToStyle(styleObj)}${props.customStyle}` : props.customStyle
|
|
32
34
|
})
|
|
33
35
|
|
|
36
|
+
/**
|
|
37
|
+
* 驼峰命名转短横线命名。
|
|
38
|
+
* @param str 驼峰字符串
|
|
39
|
+
* @returns kebab-case 字符串
|
|
40
|
+
*/
|
|
34
41
|
const kebabCase = (str: string): string => {
|
|
35
42
|
str = str.replace(str.charAt(0), str.charAt(0).toLocaleLowerCase())
|
|
36
43
|
return str.replace(/([a-z])([A-Z])/g, (_, p1, p2) => p1 + '-' + p2.toLowerCase())
|
|
37
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* 十六进制颜色转 RGB 数组。
|
|
47
|
+
* @param str 十六进制颜色字符串(如 '#ff0000' 或 '#f00')
|
|
48
|
+
* @returns RGB 逗号分隔字符串,解析失败返回 null
|
|
49
|
+
*/
|
|
38
50
|
const colorRgb = (str: string) => {
|
|
39
51
|
if (!str) return
|
|
40
52
|
var sColor = str.toLowerCase()
|
|
@@ -59,6 +71,12 @@ const colorRgb = (str: string) => {
|
|
|
59
71
|
return null
|
|
60
72
|
}
|
|
61
73
|
|
|
74
|
+
/**
|
|
75
|
+
* 将主题变量对象映射为 CSS 自定义属性。
|
|
76
|
+
* 例如 `{ colorTheme: '#4D80F0' }` 转换为 `{ '--oxy-color-theme': '#4D80F0' }`。
|
|
77
|
+
* @param themeVars 主题变量键值对
|
|
78
|
+
* @returns CSS 变量键值对
|
|
79
|
+
*/
|
|
62
80
|
const mapThemeVarsToCSSVars = (themeVars: Record<string, string>) => {
|
|
63
81
|
if (!themeVars) return
|
|
64
82
|
const cssVars: Record<string, string> = {}
|
|
@@ -958,6 +958,23 @@ export type videoPreviewThemeVars = {
|
|
|
958
958
|
videoPreviewBg?: string
|
|
959
959
|
videoPreviewCloseColor?: string
|
|
960
960
|
videoPreviewCloseFontSize?: string
|
|
961
|
+
videoPreviewCloseMargin?: string
|
|
962
|
+
videoPreviewVideoHeight?: string
|
|
963
|
+
videoPreviewCloseZIndex?: string
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
export type imagePreviewThemeVars = {
|
|
967
|
+
imagePreviewBg?: string
|
|
968
|
+
imagePreviewIndexColor?: string
|
|
969
|
+
imagePreviewIndexMargin?: string
|
|
970
|
+
imagePreviewIndexFontSize?: string
|
|
971
|
+
imagePreviewIndexLineHeight?: string
|
|
972
|
+
imagePreviewIndexFontWeight?: string
|
|
973
|
+
imagePreviewIndexZIndex?: string
|
|
974
|
+
imagePreviewCloseSize?: string
|
|
975
|
+
imagePreviewCloseColor?: string
|
|
976
|
+
imagePreviewCloseMargin?: string
|
|
977
|
+
imagePreviewCloseZIndex?: string
|
|
961
978
|
}
|
|
962
979
|
|
|
963
980
|
export type imgCropperThemeVars = {
|
|
@@ -1046,6 +1063,7 @@ export type ConfigProviderThemeVars = baseThemeVars &
|
|
|
1046
1063
|
backtopThemeVars &
|
|
1047
1064
|
indexBarThemeVars &
|
|
1048
1065
|
textThemeVars &
|
|
1066
|
+
imagePreviewThemeVars &
|
|
1049
1067
|
videoPreviewThemeVars &
|
|
1050
1068
|
imgCropperThemeVars &
|
|
1051
1069
|
floatingPanelThemeVars &
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
@import '../common/abstracts/variable';
|
|
2
2
|
@import '../common/abstracts/mixin';
|
|
3
3
|
|
|
4
|
+
$-corner-ribbon-width: 186rpx;
|
|
5
|
+
$-corner-ribbon-height: 56rpx;
|
|
6
|
+
$-corner-ribbon-radius: 56rpx;
|
|
7
|
+
$-corner-rotate-box-size: 152rpx;
|
|
8
|
+
$-corner-rotate-ribbon-width: 202rpx;
|
|
9
|
+
$-corner-rotate-ribbon-height: 64rpx;
|
|
10
|
+
$-corner-rotate-ribbon-offset: 50rpx;
|
|
11
|
+
$-corner-rotate-ribbon-inset: 20rpx;
|
|
12
|
+
$-corner-rotate-text-padding-x: $-spacing-8;
|
|
13
|
+
$-corner-horizontal-width: 280rpx;
|
|
14
|
+
$-corner-horizontal-height: 70rpx;
|
|
15
|
+
$-corner-horizontal-padding-right: $-spacing-32;
|
|
16
|
+
$-corner-embedded-notch-width: 28rpx;
|
|
17
|
+
$-corner-embedded-notch-offset: 10rpx;
|
|
18
|
+
$-corner-embedded-side-padding: $-spacing-20;
|
|
19
|
+
|
|
4
20
|
@mixin corner-type-style ($normalColor, $normalBg) {
|
|
5
21
|
background: $normalBg;
|
|
6
22
|
color: $normalColor;
|
|
@@ -11,8 +27,8 @@
|
|
|
11
27
|
position: absolute;
|
|
12
28
|
top: 0;
|
|
13
29
|
right: 0;
|
|
14
|
-
width:
|
|
15
|
-
height:
|
|
30
|
+
width: $-corner-rotate-box-size;
|
|
31
|
+
height: $-corner-rotate-box-size;
|
|
16
32
|
overflow: hidden;
|
|
17
33
|
@include when(round) {
|
|
18
34
|
border-top-right-radius: $-corner-radius;
|
|
@@ -103,8 +119,8 @@
|
|
|
103
119
|
}
|
|
104
120
|
.oxy-corner__text {
|
|
105
121
|
transform: rotate(-45deg);
|
|
106
|
-
top:
|
|
107
|
-
left: -
|
|
122
|
+
top: $-corner-rotate-ribbon-inset;
|
|
123
|
+
left: -$-corner-rotate-ribbon-offset;
|
|
108
124
|
}
|
|
109
125
|
}
|
|
110
126
|
&.is-bottom-left{
|
|
@@ -117,8 +133,8 @@
|
|
|
117
133
|
}
|
|
118
134
|
.oxy-corner__text {
|
|
119
135
|
transform: rotate(-135deg);
|
|
120
|
-
bottom:
|
|
121
|
-
left: -
|
|
136
|
+
bottom: $-corner-rotate-ribbon-inset;
|
|
137
|
+
left: -$-corner-rotate-ribbon-offset;
|
|
122
138
|
top: auto;
|
|
123
139
|
> span{
|
|
124
140
|
transform: rotate(180deg);
|
|
@@ -136,8 +152,8 @@
|
|
|
136
152
|
}
|
|
137
153
|
.oxy-corner__text {
|
|
138
154
|
transform: rotate(135deg);
|
|
139
|
-
bottom:
|
|
140
|
-
right: -
|
|
155
|
+
bottom: $-corner-rotate-ribbon-inset;
|
|
156
|
+
right: -$-corner-rotate-ribbon-offset;
|
|
141
157
|
top: auto;
|
|
142
158
|
> span{
|
|
143
159
|
transform: rotate(180deg);
|
|
@@ -149,7 +165,7 @@
|
|
|
149
165
|
&.is-top-left{
|
|
150
166
|
&::after {
|
|
151
167
|
left: auto;
|
|
152
|
-
right: -
|
|
168
|
+
right: -$-corner-embedded-notch-offset;
|
|
153
169
|
bottom: 0;
|
|
154
170
|
transform: skewX(-30deg);
|
|
155
171
|
}
|
|
@@ -158,15 +174,15 @@
|
|
|
158
174
|
top: 0;
|
|
159
175
|
left: 0;
|
|
160
176
|
border-bottom-left-radius: 0;
|
|
161
|
-
border-bottom-right-radius:
|
|
177
|
+
border-bottom-right-radius: $-corner-ribbon-radius;
|
|
162
178
|
padding-left: 0;
|
|
163
|
-
padding-right: $-
|
|
179
|
+
padding-right: $-corner-embedded-side-padding;
|
|
164
180
|
}
|
|
165
181
|
}
|
|
166
182
|
&.is-bottom-left{
|
|
167
183
|
&::after {
|
|
168
184
|
left: auto;
|
|
169
|
-
right: -
|
|
185
|
+
right: -$-corner-embedded-notch-offset;
|
|
170
186
|
bottom: 0;
|
|
171
187
|
transform: skewX(30deg);
|
|
172
188
|
}
|
|
@@ -175,9 +191,9 @@
|
|
|
175
191
|
bottom: 0;
|
|
176
192
|
left: 0;
|
|
177
193
|
border-bottom-left-radius: 0;
|
|
178
|
-
border-top-right-radius:
|
|
194
|
+
border-top-right-radius: $-corner-ribbon-radius;
|
|
179
195
|
padding-left: 0;
|
|
180
|
-
padding-right: $-
|
|
196
|
+
padding-right: $-corner-embedded-side-padding;
|
|
181
197
|
> span{
|
|
182
198
|
transform: none;
|
|
183
199
|
}
|
|
@@ -185,7 +201,7 @@
|
|
|
185
201
|
}
|
|
186
202
|
&.is-bottom-right{
|
|
187
203
|
&::after {
|
|
188
|
-
left: -
|
|
204
|
+
left: -$-corner-embedded-notch-offset;
|
|
189
205
|
bottom: 0;
|
|
190
206
|
transform: skewX(-30deg);
|
|
191
207
|
}
|
|
@@ -194,7 +210,7 @@
|
|
|
194
210
|
bottom: 0;
|
|
195
211
|
right: 0;
|
|
196
212
|
border-bottom-left-radius: 0;
|
|
197
|
-
border-top-left-radius:
|
|
213
|
+
border-top-left-radius: $-corner-ribbon-radius;
|
|
198
214
|
> span{
|
|
199
215
|
transform: none;
|
|
200
216
|
}
|
|
@@ -202,16 +218,18 @@
|
|
|
202
218
|
}
|
|
203
219
|
}
|
|
204
220
|
.oxy-corner__text {
|
|
205
|
-
width:
|
|
206
|
-
height:
|
|
221
|
+
width: $-corner-rotate-ribbon-width;
|
|
222
|
+
height: $-corner-rotate-ribbon-height;
|
|
207
223
|
position: absolute;
|
|
208
|
-
right: -
|
|
209
|
-
top:
|
|
224
|
+
right: -$-corner-rotate-ribbon-offset;
|
|
225
|
+
top: $-corner-rotate-ribbon-inset;
|
|
210
226
|
text-align: center;
|
|
211
|
-
line-height:
|
|
227
|
+
line-height: $-corner-rotate-ribbon-height;
|
|
212
228
|
overflow: hidden;
|
|
213
229
|
transform: rotate(45deg);
|
|
214
230
|
box-sizing: border-box;
|
|
231
|
+
padding-left: $-corner-rotate-text-padding-x;
|
|
232
|
+
padding-right: $-corner-rotate-text-padding-x;
|
|
215
233
|
white-space: nowrap;
|
|
216
234
|
text-align: center;
|
|
217
235
|
font-size: $-corner-font-size;
|
|
@@ -219,27 +237,27 @@
|
|
|
219
237
|
}
|
|
220
238
|
}
|
|
221
239
|
&.is-horizontal {
|
|
222
|
-
width:
|
|
223
|
-
height:
|
|
240
|
+
width: $-corner-horizontal-width;
|
|
241
|
+
height: $-corner-horizontal-height;
|
|
224
242
|
.oxy-corner__text {
|
|
225
|
-
padding-right:
|
|
243
|
+
padding-right: $-corner-horizontal-padding-right;
|
|
226
244
|
box-sizing: border-box;
|
|
227
245
|
font-size: $-corner-horizontal-font-size;
|
|
228
246
|
font-weight: $-corner-horizontal-font-weight;
|
|
229
|
-
line-height:
|
|
247
|
+
line-height: $-corner-horizontal-height;
|
|
230
248
|
text-align: right;
|
|
231
249
|
}
|
|
232
250
|
}
|
|
233
251
|
&.is-embedded {
|
|
234
|
-
width:
|
|
235
|
-
height:
|
|
252
|
+
width: $-corner-ribbon-width;
|
|
253
|
+
height: $-corner-ribbon-height;
|
|
236
254
|
&::after {
|
|
237
255
|
content: '';
|
|
238
256
|
position: absolute;
|
|
239
|
-
left: -
|
|
257
|
+
left: -$-corner-embedded-notch-offset;
|
|
240
258
|
bottom: 0;
|
|
241
|
-
width:
|
|
242
|
-
height:
|
|
259
|
+
width: $-corner-embedded-notch-width;
|
|
260
|
+
height: $-corner-ribbon-height;
|
|
243
261
|
background-color: $-color-white;
|
|
244
262
|
transform: skewX(30deg);
|
|
245
263
|
}
|
|
@@ -247,11 +265,11 @@
|
|
|
247
265
|
right: 0;
|
|
248
266
|
top: 0;
|
|
249
267
|
transform: none;
|
|
250
|
-
padding-left: $-
|
|
268
|
+
padding-left: $-corner-embedded-side-padding;
|
|
251
269
|
box-sizing: border-box;
|
|
252
270
|
font-size: $-corner-embedded-font-size;
|
|
253
271
|
font-weight: $-corner-embedded-font-weight;
|
|
254
|
-
border-bottom-left-radius:
|
|
272
|
+
border-bottom-left-radius: $-corner-ribbon-radius;
|
|
255
273
|
}
|
|
256
274
|
}
|
|
257
275
|
}
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
export default {
|
|
20
20
|
name: 'oxy-count-to',
|
|
21
21
|
options: {
|
|
22
|
+
// #ifndef MP-TOUTIAO
|
|
22
23
|
virtualHost: true,
|
|
24
|
+
// #endif
|
|
23
25
|
addGlobalClass: true,
|
|
24
26
|
styleIsolation: 'shared'
|
|
25
27
|
}
|
|
@@ -67,6 +69,11 @@ function resetTime() {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
|
|
72
|
+
/**
|
|
73
|
+
* 根据当前剩余时间计算数字显示值,支持缓动函数
|
|
74
|
+
* @param remain - 剩余时间(毫秒)
|
|
75
|
+
* @returns 格式化后的数字文本
|
|
76
|
+
*/
|
|
70
77
|
function parseFormat(remain: number) {
|
|
71
78
|
const { startVal, endVal, duration, useEasing } = props
|
|
72
79
|
const progress = duration - remain // 已经进行的时间
|
|
@@ -95,7 +102,11 @@ function parseFormat(remain: number) {
|
|
|
95
102
|
return formatNumber(currentVal)
|
|
96
103
|
}
|
|
97
104
|
|
|
98
|
-
|
|
105
|
+
/**
|
|
106
|
+
* 格式化数字:添加千位分隔符、小数位
|
|
107
|
+
* @param num - 数值
|
|
108
|
+
* @returns 格式化后的字符串,如 "1,234.56"
|
|
109
|
+
*/
|
|
99
110
|
function formatNumber(num: any): string {
|
|
100
111
|
if (typeof num !== 'number') {
|
|
101
112
|
num = parseFloat(num)
|