vue2server7 7.0.29 → 7.0.30

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.
@@ -102,8 +102,8 @@ const props = withDefaults(defineProps<{
102
102
  endPlaceholder: '结束日期',
103
103
  separator: '至',
104
104
  pickerType: 'date',
105
- valueFormat: 'YYYY-MM-DD',
106
- displayFormat: undefined,
105
+ valueFormat: 'YYYYMMDD',
106
+ displayFormat: 'YYYY-MM-DD',
107
107
  disabled: false,
108
108
  linkage: true,
109
109
  maxSpanDays: undefined,
@@ -127,8 +127,16 @@ const startFocused = ref(false)
127
127
  const endFocused = ref(false)
128
128
  const hasBlurred = ref(false)
129
129
 
130
+ /** 解析绑定值:支持 YYYYMMDD(与默认 valueFormat 一致)及 ISO 等可被 Date 解析的字符串 */
130
131
  function toDate(val: string | null | undefined): Date | null {
131
132
  if (!val) return null
133
+ if (/^\d{8}$/.test(val)) {
134
+ const y = Number(val.slice(0, 4))
135
+ const m = Number(val.slice(4, 6)) - 1
136
+ const day = Number(val.slice(6, 8))
137
+ const d = new Date(y, m, day)
138
+ return Number.isNaN(d.getTime()) ? null : d
139
+ }
132
140
  const d = new Date(val)
133
141
  return Number.isNaN(d.getTime()) ? null : d
134
142
  }
@@ -76,7 +76,7 @@ const startField = ref<string | null>(null)
76
76
  const endField = ref<string | null>(null)
77
77
  const rangeMaxSpan = ref<DateRangeValue>([null, null])
78
78
  const rangeDatetime = ref<DateRangeValue>([null, null])
79
- const rangeDisabled = ref<DateRangeValue>(['2026-01-01', '2026-01-31'])
79
+ const rangeDisabled = ref<DateRangeValue>(['20260101', '20260131'])
80
80
  </script>
81
81
 
82
82
  <style scoped>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2server7",
3
- "version": "7.0.29",
3
+ "version": "7.0.30",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "nodemon --watch src --ext ts --exec \"ts-node src/app.ts\"",