vue2server7 7.0.31 → 7.0.32
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.
|
@@ -42,6 +42,9 @@ import { ref, watch, computed } from 'vue'
|
|
|
42
42
|
|
|
43
43
|
export type DateRangeValue = [string | null, string | null]
|
|
44
44
|
|
|
45
|
+
/** 父级传入的 v-model:规范为 [start, end],也可能为空数组 */
|
|
46
|
+
export type DateRangeModelProp = DateRangeValue | []
|
|
47
|
+
|
|
45
48
|
export type MaxSpanDaysInput = number | [number]
|
|
46
49
|
|
|
47
50
|
function resolveMaxSpanDays(v: MaxSpanDaysInput | undefined): number | null {
|
|
@@ -68,8 +71,8 @@ function inclusiveDaySpan(start: Date, end: Date): number {
|
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
const props = withDefaults(defineProps<{
|
|
71
|
-
/** 数组模式绑定值 [start, end] */
|
|
72
|
-
modelValue?:
|
|
74
|
+
/** 数组模式绑定值 [start, end];亦可能为空数组 */
|
|
75
|
+
modelValue?: DateRangeModelProp
|
|
73
76
|
/** 双字段模式 - 起始日期 */
|
|
74
77
|
start?: string | null
|
|
75
78
|
/** 双字段模式 - 结束日期 */
|
|
@@ -111,11 +114,12 @@ const props = withDefaults(defineProps<{
|
|
|
111
114
|
maxSpanErrorMessage: undefined
|
|
112
115
|
})
|
|
113
116
|
|
|
117
|
+
/** 使用 call-signature 形式,避免部分 vue-tsc 版本对对象形式 emits 推断成单事件而报 TS2769 */
|
|
114
118
|
const emit = defineEmits<{
|
|
115
|
-
'update:modelValue'
|
|
116
|
-
'update:start'
|
|
117
|
-
'update:end'
|
|
118
|
-
'validate'
|
|
119
|
+
(e: 'update:modelValue', value: DateRangeValue): void
|
|
120
|
+
(e: 'update:start', value: string | null): void
|
|
121
|
+
(e: 'update:end', value: string | null): void
|
|
122
|
+
(e: 'validate', valid: boolean): void
|
|
119
123
|
}>()
|
|
120
124
|
|
|
121
125
|
const isArrayMode = computed(() => props.modelValue !== undefined)
|