vue2server7 1.0.1 → 2.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2server7",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "nodemon --watch src --ext ts --exec \"ts-node src/app.ts\"",
package/test/d.txt DELETED
@@ -1,49 +0,0 @@
1
- <template>
2
- <el-date-picker
3
- v-model="dateRange"
4
- type="daterange"
5
- start-placeholder="开始日期"
6
- end-placeholder="结束日期"
7
- :disabled-date="disabledDate"
8
- @calendar-change="handleCalendarChange"
9
- @visible-change="handleVisibleChange"
10
- />
11
- </template>
12
-
13
- <script setup>
14
- import { ref } from 'vue'
15
- import dayjs from 'dayjs'
16
-
17
- const dateRange = ref([]) // [start, end]
18
- const pickingStart = ref(null) // 正在“点选中的开始日期”
19
-
20
- const handleCalendarChange = (val) => {
21
- // val 始终是 [start, end],end 在没选完时可能是 null
22
- const [start, end] = val || []
23
-
24
- // 只选了开始日期(正在选结束日期)
25
- if (start && !end) {
26
- pickingStart.value = start
27
- return
28
- }
29
-
30
- // 选完了 or 清空了 -> 重置
31
- pickingStart.value = null
32
- }
33
-
34
- // 面板关闭时也重置,避免下次打开还沿用旧的 start
35
- const handleVisibleChange = (visible) => {
36
- if (!visible) pickingStart.value = null
37
- }
38
-
39
- const disabledDate = (time) => {
40
- // 只有在“已选开始、未选结束”的过程中才限制
41
- if (!pickingStart.value) return false
42
-
43
- const start = dayjs(pickingStart.value).startOf('day')
44
- const cur = dayjs(time).startOf('day')
45
-
46
- const diff = Math.abs(cur.diff(start, 'day'))
47
- return diff > 15
48
- }
49
- </script>