hy-app 0.2.14 → 0.2.16
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/hy-action-sheet/hy-action-sheet.vue +81 -13
- package/components/hy-action-sheet/typing.d.ts +1 -3
- package/components/hy-address-picker/hy-address-picker.vue +109 -8
- package/components/hy-address-picker/index.scss +2 -2
- package/components/hy-address-picker/typing.d.ts +39 -30
- package/components/hy-avatar/hy-avatar.vue +78 -4
- package/components/hy-avatar/typing.d.ts +21 -16
- package/components/hy-back-top/hy-back-top.vue +86 -28
- package/components/hy-back-top/typing.d.ts +17 -12
- package/components/hy-badge/hy-badge.vue +114 -43
- package/components/hy-badge/typing.d.ts +20 -15
- package/components/hy-button/hy-button.vue +22 -40
- package/components/hy-calendar/hy-calendar.vue +290 -143
- package/components/hy-calendar/typing.d.ts +38 -31
- package/components/hy-card/hy-card.vue +139 -36
- package/components/hy-card/typing.d.ts +39 -28
- package/components/hy-cell/hy-cell.vue +131 -67
- package/components/hy-cell/typing.d.ts +6 -1
- package/components/hy-check-button/hy-check-button.vue +101 -32
- package/components/hy-check-button/typing.d.ts +26 -19
- package/components/hy-checkbox/hy-checkbox.vue +167 -78
- package/components/hy-checkbox/typing.d.ts +26 -19
- package/components/hy-code-input/hy-code-input.vue +101 -5
- package/components/hy-code-input/typing.d.ts +9 -0
- package/components/hy-config-provider/hy-config-provider.vue +44 -24
- package/components/hy-config-provider/typing.d.ts +0 -4
- package/components/hy-count-down/hy-count-down.vue +99 -62
- package/components/hy-count-down/typing.d.ts +18 -5
- package/components/hy-count-to/hy-count-to.vue +165 -113
- package/components/hy-count-to/typing.d.ts +15 -11
- package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
- package/components/hy-datetime-picker/typing.d.ts +49 -39
- package/components/hy-divider/hy-divider.vue +128 -64
- package/components/hy-divider/typing.d.ts +16 -16
- package/components/hy-dropdown/hy-dropdown.vue +57 -19
- package/components/hy-dropdown/typing.d.ts +14 -14
- package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
- package/components/hy-dropdown-item/typing.d.ts +13 -6
- package/components/hy-empty/hy-empty.vue +64 -6
- package/components/hy-empty/typing.d.ts +5 -0
- package/components/hy-float-button/hy-float-button.vue +117 -5
- package/components/hy-float-button/typing.d.ts +7 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
- package/components/hy-folding-panel/typing.d.ts +24 -15
- package/components/hy-grid/hy-grid.vue +95 -35
- package/components/hy-grid/typing.d.ts +24 -19
- package/components/hy-icon/hy-icon.vue +84 -6
- package/components/hy-icon/typing.d.ts +5 -0
- package/components/hy-image/hy-image.vue +105 -6
- package/components/hy-image/typing.d.ts +9 -0
- package/components/hy-input/hy-input.vue +277 -130
- package/components/hy-input/props.ts +13 -14
- package/components/hy-input/typing.d.ts +59 -38
- package/components/hy-line/hy-line.vue +65 -25
- package/components/hy-line-progress/hy-line-progress.vue +68 -35
- package/components/hy-list/hy-list.vue +127 -61
- package/components/hy-list/typing.d.ts +19 -12
- package/components/hy-loading/hy-loading.vue +79 -25
- package/components/hy-menu/hy-menu.vue +69 -45
- package/components/hy-menu/typing.d.ts +22 -15
- package/components/hy-modal/hy-modal.vue +91 -4
- package/components/hy-modal/typing.d.ts +11 -0
- package/components/hy-navbar/hy-navbar.vue +105 -25
- package/components/hy-navbar/typing.d.ts +25 -20
- package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
- package/components/hy-notice-bar/typing.d.ts +22 -17
- package/components/hy-notify/hy-notify.vue +106 -54
- package/components/hy-number-step/hy-number-step.vue +211 -120
- package/components/hy-number-step/typing.d.ts +45 -28
- package/components/hy-overlay/hy-overlay.vue +60 -16
- package/components/hy-overlay/typing.d.ts +11 -6
- package/components/hy-pagination/hy-pagination.vue +94 -37
- package/components/hy-pagination/typing.d.ts +20 -11
- package/components/hy-picker/hy-picker.vue +225 -160
- package/components/hy-picker/typing.d.ts +51 -28
- package/components/hy-popover/hy-popover.vue +55 -7
- package/components/hy-popover/typing.d.ts +21 -1
- package/components/hy-popup/hy-popup.vue +164 -99
- package/components/hy-popup/typing.d.ts +11 -0
- package/components/hy-price/hy-price.vue +77 -30
- package/components/hy-price/typing.d.ts +10 -10
- package/components/hy-qrcode/hy-qrcode.vue +75 -5
- package/components/hy-qrcode/typing.d.ts +25 -16
- package/components/hy-radio/hy-radio.vue +169 -88
- package/components/hy-radio/typing.d.ts +29 -22
- package/components/hy-rate/hy-rate.vue +155 -104
- package/components/hy-rate/typing.d.ts +23 -16
- package/components/hy-read-more/hy-read-more.vue +83 -56
- package/components/hy-read-more/typing.d.ts +18 -11
- package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
- package/components/hy-scroll-list/typing.d.ts +14 -7
- package/components/hy-search/hy-search.vue +168 -62
- package/components/hy-search/typing.d.ts +47 -26
- package/components/hy-signature/hy-signature.vue +354 -272
- package/components/hy-signature/typing.d.ts +65 -52
- package/components/hy-slider/hy-slider.vue +208 -160
- package/components/hy-slider/typing.d.ts +28 -17
- package/components/hy-steps/hy-steps.vue +125 -99
- package/components/hy-steps/typing.d.ts +21 -14
- package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
- package/components/hy-submit-bar/typing.d.ts +30 -23
- package/components/hy-subsection/hy-subsection.vue +139 -96
- package/components/hy-subsection/typing.d.ts +23 -16
- package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
- package/components/hy-swipe-action/typing.d.ts +26 -17
- package/components/hy-swiper/hy-swiper.vue +178 -73
- package/components/hy-swiper/typing.d.ts +37 -28
- package/components/hy-switch/hy-switch.vue +107 -60
- package/components/hy-switch/typing.d.ts +25 -18
- package/components/hy-tabs/hy-tabs.vue +170 -160
- package/components/hy-tabs/typing.d.ts +36 -22
- package/components/hy-tag/hy-tag.vue +133 -58
- package/components/hy-tag/typing.d.ts +26 -18
- package/components/hy-text/hy-text.vue +106 -6
- package/components/hy-text/typing.d.ts +31 -26
- package/components/hy-textarea/hy-textarea.vue +183 -89
- package/components/hy-textarea/typing.d.ts +41 -24
- package/components/hy-tooltip/hy-tooltip.vue +145 -101
- package/components/hy-tooltip/typing.d.ts +18 -13
- package/components/hy-transition/hy-transition.vue +48 -13
- package/components/hy-transition/typing.d.ts +17 -0
- package/components/hy-upload/hy-upload.vue +113 -148
- package/components/hy-upload/typing.d.ts +71 -71
- package/components/hy-warn/hy-warn.vue +79 -36
- package/components/hy-warn/typing.d.ts +18 -11
- package/components/hy-waterfall/hy-waterfall.vue +90 -77
- package/components/hy-watermark/hy-watermark.vue +82 -5
- package/components/hy-watermark/typing.d.ts +20 -20
- package/global.d.ts +39 -59
- package/package.json +4 -19
- package/utils/inspect.ts +3 -1
- package/web-types.json +1 -1
- package/compiler.ts +0 -108
- package/component-helper.ts +0 -179
- package/components.json +0 -3287
- package/docgen.config.js +0 -13
- package/web-types.config.js +0 -7
|
@@ -1,53 +1,73 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view :class="themeClass" :style="themeStyle">
|
|
3
|
+
<!-- @slot 默认插槽 -->
|
|
3
4
|
<slot />
|
|
4
5
|
</view>
|
|
5
6
|
</template>
|
|
6
7
|
|
|
7
8
|
<script lang="ts">
|
|
9
|
+
/**
|
|
10
|
+
* 将 ConfigProvider 组件的 theme 属性设置为 dark,可以开启深色模式。 深色模式会全局生效,使页面上的所有 Wot 组件变为深色风格。
|
|
11
|
+
* @displayName hy-config-provider
|
|
12
|
+
*/
|
|
13
|
+
defineOptions({})
|
|
8
14
|
export default {
|
|
9
|
-
name:
|
|
15
|
+
name: 'hy-config-provider',
|
|
10
16
|
options: {
|
|
11
17
|
addGlobalClass: true,
|
|
12
18
|
virtualHost: true,
|
|
13
|
-
styleIsolation:
|
|
19
|
+
styleIsolation: 'shared',
|
|
14
20
|
},
|
|
15
|
-
}
|
|
21
|
+
}
|
|
16
22
|
</script>
|
|
17
23
|
|
|
18
24
|
<script setup lang="ts">
|
|
19
|
-
import { computed, toRefs } from
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { addUnit } from "@/package";
|
|
23
|
-
import { colorGradient } from "@/package/utils";
|
|
25
|
+
import { computed, type CSSProperties, type PropType, toRefs } from 'vue'
|
|
26
|
+
import { addUnit, colorGradient } from '../../utils'
|
|
27
|
+
import { ColorConfig } from '../../config'
|
|
24
28
|
|
|
25
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
/**
|
|
32
|
+
* 主题色,暗色或者默认白色
|
|
33
|
+
* @values dark,light
|
|
34
|
+
* */
|
|
35
|
+
theme: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'light',
|
|
38
|
+
},
|
|
39
|
+
/** 主题色 */
|
|
40
|
+
themeColor: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: ColorConfig.primary,
|
|
43
|
+
},
|
|
44
|
+
/** 内边距 */
|
|
45
|
+
padding: [String, Number],
|
|
46
|
+
/** 定义需要用到的主题类名 */
|
|
47
|
+
customClass: String,
|
|
48
|
+
/** 定义需要用到的外部样式 */
|
|
49
|
+
customStyle: {
|
|
50
|
+
type: Object as PropType<CSSProperties>,
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
const { theme, themeColor, customClass, customStyle, padding } = toRefs(props)
|
|
34
54
|
|
|
35
55
|
const themeClass = computed(() => {
|
|
36
|
-
return [customClass.value,
|
|
37
|
-
})
|
|
56
|
+
return [customClass.value, 'hy-config-provider', `hy-theme--${theme.value}`]
|
|
57
|
+
})
|
|
38
58
|
|
|
39
59
|
const themeStyle = computed(() => {
|
|
40
60
|
return [
|
|
41
61
|
{
|
|
42
|
-
|
|
43
|
-
|
|
62
|
+
'--hy-theme-color': themeColor.value,
|
|
63
|
+
'--hy-theme--light': colorGradient(themeColor.value)[90],
|
|
44
64
|
padding: addUnit(padding.value),
|
|
45
65
|
},
|
|
46
66
|
customStyle.value,
|
|
47
|
-
]
|
|
48
|
-
})
|
|
67
|
+
]
|
|
68
|
+
})
|
|
49
69
|
</script>
|
|
50
70
|
|
|
51
71
|
<style scoped lang="scss">
|
|
52
|
-
@import
|
|
72
|
+
@import './index.scss';
|
|
53
73
|
</style>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="hy-count-down">
|
|
2
|
+
<view :class="['hy-count-down', customClass]" :style="customStyle">
|
|
3
|
+
<!--
|
|
4
|
+
@slot 默认插槽
|
|
5
|
+
@param {String | Number} record
|
|
6
|
+
-->
|
|
3
7
|
<slot :record="timeData">
|
|
4
8
|
<text class="hy-count-down__text">{{ formattedTime }}</text>
|
|
5
9
|
</slot>
|
|
@@ -7,155 +11,188 @@
|
|
|
7
11
|
</template>
|
|
8
12
|
|
|
9
13
|
<script lang="ts">
|
|
14
|
+
/**
|
|
15
|
+
* 一般使用于某个活动的截止时间上,通过数字的变化,给用户明确的时间感受,提示用户进行某一个行为操作。
|
|
16
|
+
* @displayName hy-count-down
|
|
17
|
+
*/
|
|
18
|
+
defineOptions({})
|
|
10
19
|
export default {
|
|
11
20
|
name: 'hy-count-down',
|
|
12
21
|
options: {
|
|
13
22
|
addGlobalClass: true,
|
|
14
23
|
virtualHost: true,
|
|
15
|
-
styleIsolation: 'shared'
|
|
16
|
-
}
|
|
24
|
+
styleIsolation: 'shared',
|
|
25
|
+
},
|
|
17
26
|
}
|
|
18
27
|
</script>
|
|
19
28
|
|
|
20
29
|
<script setup lang="ts">
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
30
|
+
import { onMounted, onUnmounted, ref, toRefs, watch } from 'vue'
|
|
31
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
32
|
+
import { isSameSecond, parseFormat, parseTimeData } from './index'
|
|
33
|
+
import { ICountDownEmits } from './typing'
|
|
25
34
|
|
|
26
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
27
|
-
const
|
|
28
|
-
|
|
35
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
36
|
+
const props = defineProps({
|
|
37
|
+
/** 倒计时时长,单位ms */
|
|
38
|
+
time: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 0,
|
|
41
|
+
},
|
|
42
|
+
/** 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒 */
|
|
43
|
+
format: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: 'HH:mm:ss',
|
|
46
|
+
},
|
|
47
|
+
/** 是否自动开始倒计时 */
|
|
48
|
+
autoStart: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: true,
|
|
51
|
+
},
|
|
52
|
+
/** 是否展示毫秒倒计时 */
|
|
53
|
+
millisecond: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
/** 定义需要用到的外部样式 */
|
|
58
|
+
customStyle: {
|
|
59
|
+
type: Object as PropType<CSSProperties>,
|
|
60
|
+
},
|
|
61
|
+
/** 自定义外部类名 */
|
|
62
|
+
customClass: String,
|
|
63
|
+
})
|
|
64
|
+
const { time, autoStart, millisecond, format } = toRefs(props)
|
|
65
|
+
const emit = defineEmits<ICountDownEmits>()
|
|
29
66
|
|
|
30
|
-
let timer: any
|
|
67
|
+
let timer: any
|
|
31
68
|
// 各单位(天,时,分等)剩余时间
|
|
32
|
-
const timeData = ref(parseTimeData(time.value))
|
|
69
|
+
const timeData = ref(parseTimeData(time.value))
|
|
33
70
|
// 格式化后的时间,如"03:23:21"
|
|
34
|
-
const formattedTime = ref(
|
|
71
|
+
const formattedTime = ref('')
|
|
35
72
|
// 倒计时是否正在进行中
|
|
36
|
-
const runing = ref(false)
|
|
73
|
+
const runing = ref(false)
|
|
37
74
|
// 结束的毫秒时间戳
|
|
38
|
-
const endTime = ref(0)
|
|
75
|
+
const endTime = ref(0)
|
|
39
76
|
// 剩余的毫秒时间
|
|
40
|
-
const remainTime = ref(0)
|
|
77
|
+
const remainTime = ref(0)
|
|
41
78
|
|
|
42
79
|
watch(
|
|
43
80
|
() => time.value,
|
|
44
81
|
() => reset(),
|
|
45
|
-
)
|
|
82
|
+
)
|
|
46
83
|
|
|
47
84
|
onMounted(() => {
|
|
48
|
-
reset()
|
|
49
|
-
})
|
|
85
|
+
reset()
|
|
86
|
+
})
|
|
50
87
|
|
|
51
88
|
onUnmounted(() => {
|
|
52
|
-
clearTimeoutFn()
|
|
53
|
-
})
|
|
89
|
+
clearTimeoutFn()
|
|
90
|
+
})
|
|
54
91
|
|
|
55
92
|
/**
|
|
56
93
|
* @description 开始倒计时
|
|
57
94
|
*/
|
|
58
95
|
const start = () => {
|
|
59
|
-
if (runing.value) return
|
|
96
|
+
if (runing.value) return
|
|
60
97
|
// 标识为进行中
|
|
61
|
-
runing.value = true
|
|
98
|
+
runing.value = true
|
|
62
99
|
// 结束时间戳 = 此刻时间戳 + 剩余的时间
|
|
63
|
-
endTime.value = Date.now() + remainTime.value
|
|
64
|
-
toTick()
|
|
65
|
-
}
|
|
100
|
+
endTime.value = Date.now() + remainTime.value
|
|
101
|
+
toTick()
|
|
102
|
+
}
|
|
66
103
|
|
|
67
104
|
/**
|
|
68
105
|
* @description 根据是否展示毫秒,执行不同操作函数
|
|
69
106
|
*/
|
|
70
107
|
const toTick = () => {
|
|
71
108
|
if (millisecond.value) {
|
|
72
|
-
microTick()
|
|
109
|
+
microTick()
|
|
73
110
|
} else {
|
|
74
|
-
macroTick()
|
|
111
|
+
macroTick()
|
|
75
112
|
}
|
|
76
|
-
}
|
|
113
|
+
}
|
|
77
114
|
const macroTick = () => {
|
|
78
|
-
clearTimeoutFn()
|
|
115
|
+
clearTimeoutFn()
|
|
79
116
|
// 每隔一定时间,更新一遍定时器的值
|
|
80
117
|
// 同时此定时器的作用也能带来毫秒级的更新
|
|
81
118
|
timer = setTimeout(() => {
|
|
82
119
|
// 获取剩余时间
|
|
83
|
-
const remain = getRemainTime()
|
|
120
|
+
const remain = getRemainTime()
|
|
84
121
|
// 重设剩余时间
|
|
85
122
|
if (!isSameSecond(remain, remainTime.value) || remain === 0) {
|
|
86
|
-
setRemainTime(remain)
|
|
123
|
+
setRemainTime(remain)
|
|
87
124
|
}
|
|
88
125
|
// 如果剩余时间不为0,则继续检查更新倒计时
|
|
89
126
|
if (remainTime.value !== 0) {
|
|
90
|
-
macroTick()
|
|
127
|
+
macroTick()
|
|
91
128
|
}
|
|
92
|
-
}, 30)
|
|
93
|
-
}
|
|
129
|
+
}, 30)
|
|
130
|
+
}
|
|
94
131
|
|
|
95
132
|
const microTick = () => {
|
|
96
|
-
clearTimeoutFn()
|
|
133
|
+
clearTimeoutFn()
|
|
97
134
|
timer = setTimeout(() => {
|
|
98
|
-
setRemainTime(getRemainTime())
|
|
135
|
+
setRemainTime(getRemainTime())
|
|
99
136
|
if (remainTime.value !== 0) {
|
|
100
|
-
microTick()
|
|
137
|
+
microTick()
|
|
101
138
|
}
|
|
102
|
-
}, 50)
|
|
103
|
-
}
|
|
139
|
+
}, 50)
|
|
140
|
+
}
|
|
104
141
|
|
|
105
142
|
/**
|
|
106
143
|
* @description 获取剩余的时间
|
|
107
144
|
*/
|
|
108
145
|
const getRemainTime = () => {
|
|
109
146
|
// 取最大值,防止出现小于0的剩余时间值
|
|
110
|
-
return Math.max(endTime.value - Date.now(), 0)
|
|
111
|
-
}
|
|
147
|
+
return Math.max(endTime.value - Date.now(), 0)
|
|
148
|
+
}
|
|
112
149
|
/**
|
|
113
150
|
* @description 设置剩余的时间
|
|
114
151
|
*/
|
|
115
152
|
const setRemainTime = (remain: number) => {
|
|
116
|
-
remainTime.value = remain
|
|
153
|
+
remainTime.value = remain
|
|
117
154
|
// 根据剩余的毫秒时间,得出该有天,小时,分钟等的值,返回一个对象
|
|
118
|
-
timeData.value = parseTimeData(remain)
|
|
119
|
-
emit(
|
|
155
|
+
timeData.value = parseTimeData(remain)
|
|
156
|
+
emit('change', timeData.value)
|
|
120
157
|
// 得出格式化后的时间
|
|
121
|
-
formattedTime.value = parseFormat(format.value, timeData.value)
|
|
158
|
+
formattedTime.value = parseFormat(format.value, timeData.value)
|
|
122
159
|
// 如果时间已到,停止倒计时
|
|
123
160
|
if (remain <= 0) {
|
|
124
|
-
pause()
|
|
125
|
-
emit(
|
|
161
|
+
pause()
|
|
162
|
+
emit('finish')
|
|
126
163
|
}
|
|
127
|
-
}
|
|
164
|
+
}
|
|
128
165
|
// 重置倒计时
|
|
129
166
|
const reset = () => {
|
|
130
|
-
pause()
|
|
131
|
-
remainTime.value = time.value
|
|
132
|
-
setRemainTime(remainTime.value)
|
|
167
|
+
pause()
|
|
168
|
+
remainTime.value = time.value
|
|
169
|
+
setRemainTime(remainTime.value)
|
|
133
170
|
if (autoStart.value) {
|
|
134
|
-
start()
|
|
171
|
+
start()
|
|
135
172
|
}
|
|
136
|
-
}
|
|
173
|
+
}
|
|
137
174
|
/**
|
|
138
175
|
* @description 暂停倒计时
|
|
139
176
|
* */
|
|
140
177
|
const pause = () => {
|
|
141
|
-
runing.value = false
|
|
142
|
-
clearTimeoutFn()
|
|
143
|
-
}
|
|
178
|
+
runing.value = false
|
|
179
|
+
clearTimeoutFn()
|
|
180
|
+
}
|
|
144
181
|
/**
|
|
145
182
|
* @description 清空定时器
|
|
146
183
|
* */
|
|
147
184
|
const clearTimeoutFn = () => {
|
|
148
|
-
clearTimeout(timer)
|
|
149
|
-
timer = null
|
|
150
|
-
}
|
|
185
|
+
clearTimeout(timer)
|
|
186
|
+
timer = null
|
|
187
|
+
}
|
|
151
188
|
|
|
152
189
|
defineExpose({
|
|
153
190
|
reset,
|
|
154
191
|
start,
|
|
155
192
|
pause,
|
|
156
|
-
})
|
|
193
|
+
})
|
|
157
194
|
</script>
|
|
158
195
|
|
|
159
196
|
<style scoped lang="scss">
|
|
160
|
-
@import
|
|
197
|
+
@import './index.scss';
|
|
161
198
|
</style>
|
|
@@ -1,20 +1,33 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
2
|
|
|
3
3
|
export default interface HyCountDownProps {
|
|
4
4
|
/**
|
|
5
5
|
* @description 倒计时时长,单位ms (默认 0 )
|
|
6
6
|
* */
|
|
7
|
-
time: number
|
|
7
|
+
time: number
|
|
8
8
|
/**
|
|
9
9
|
* @description 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒 (默认 'HH:mm:ss' )
|
|
10
10
|
* */
|
|
11
|
-
format?: string
|
|
11
|
+
format?: string
|
|
12
12
|
/**
|
|
13
13
|
* @description 是否自动开始倒计时 (默认 true )
|
|
14
14
|
* */
|
|
15
|
-
autoStart?: boolean
|
|
15
|
+
autoStart?: boolean
|
|
16
16
|
/**
|
|
17
17
|
* @description 是否展示毫秒倒计时 (默认 false )
|
|
18
18
|
* */
|
|
19
|
-
millisecond?: boolean
|
|
19
|
+
millisecond?: boolean
|
|
20
|
+
}
|
|
21
|
+
type TimeDataVo = {
|
|
22
|
+
days: number
|
|
23
|
+
hours: number
|
|
24
|
+
minutes: number
|
|
25
|
+
seconds: number
|
|
26
|
+
milliseconds: number
|
|
27
|
+
}
|
|
28
|
+
export interface ICountDownEmits {
|
|
29
|
+
/** 过程中,倒计时变化时触发 */
|
|
30
|
+
(e: 'change', time: TimeDataVo): void
|
|
31
|
+
/** 倒计时结束触发 */
|
|
32
|
+
(e: 'finish'): void
|
|
20
33
|
}
|