vue2server7 7.0.31 → 7.0.33

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,12 @@ import { ref, watch, computed } from 'vue'
42
42
 
43
43
  export type DateRangeValue = [string | null, string | null]
44
44
 
45
+ /**
46
+ * 父级 v-model:约定前两格为 [start, end]。
47
+ * 使用 ReadonlyArray 以兼容表单里的 `string[]`、空数组等(避免 `DateRangeValue | []` 与 `string[]` 不兼容)。
48
+ */
49
+ export type DateRangeModelProp = ReadonlyArray<string | null>
50
+
45
51
  export type MaxSpanDaysInput = number | [number]
46
52
 
47
53
  function resolveMaxSpanDays(v: MaxSpanDaysInput | undefined): number | null {
@@ -68,8 +74,8 @@ function inclusiveDaySpan(start: Date, end: Date): number {
68
74
  }
69
75
 
70
76
  const props = withDefaults(defineProps<{
71
- /** 数组模式绑定值 [start, end] */
72
- modelValue?: DateRangeValue
77
+ /** 数组模式绑定值 [start, end];亦可能为空数组 */
78
+ modelValue?: DateRangeModelProp
73
79
  /** 双字段模式 - 起始日期 */
74
80
  start?: string | null
75
81
  /** 双字段模式 - 结束日期 */
@@ -111,11 +117,12 @@ const props = withDefaults(defineProps<{
111
117
  maxSpanErrorMessage: undefined
112
118
  })
113
119
 
120
+ /** 使用 call-signature 形式,避免部分 vue-tsc 版本对对象形式 emits 推断成单事件而报 TS2769 */
114
121
  const emit = defineEmits<{
115
- 'update:modelValue': [value: DateRangeValue]
116
- 'update:start': [value: string | null]
117
- 'update:end': [value: string | null]
118
- 'validate': [valid: boolean]
122
+ (e: 'update:modelValue', value: DateRangeValue): void
123
+ (e: 'update:start', value: string | null): void
124
+ (e: 'update:end', value: string | null): void
125
+ (e: 'validate', valid: boolean): void
119
126
  }>()
120
127
 
121
128
  const isArrayMode = computed(() => props.modelValue !== undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2server7",
3
- "version": "7.0.31",
3
+ "version": "7.0.33",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "nodemon --watch src --ext ts --exec \"ts-node src/app.ts\"",