vue2server7 1.0.0 → 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
|
Binary file
|
package/test/d.txt
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-date-picker
|
|
3
|
-
v-model="dateRange"
|
|
4
|
-
type="daterange"
|
|
5
|
-
range-separator="至"
|
|
6
|
-
start-placeholder="开始日期"
|
|
7
|
-
end-placeholder="结束日期"
|
|
8
|
-
:disabled-date="disabledDate"
|
|
9
|
-
@calendar-change="handleCalendarChange"
|
|
10
|
-
/>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script setup>
|
|
14
|
-
import { ref } from 'vue'
|
|
15
|
-
import dayjs from 'dayjs'
|
|
16
|
-
|
|
17
|
-
const dateRange = ref([])
|
|
18
|
-
const minDate = ref(null)
|
|
19
|
-
|
|
20
|
-
// 监听选中日期变化(用于记录第一次点击的日期)
|
|
21
|
-
const handleCalendarChange = (val) => {
|
|
22
|
-
if (val && val.length === 1) {
|
|
23
|
-
minDate.value = val[0]
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 限制日期函数
|
|
28
|
-
const disabledDate = (time) => {
|
|
29
|
-
if (!minDate.value) return false
|
|
30
|
-
|
|
31
|
-
const start = dayjs(minDate.value)
|
|
32
|
-
const current = dayjs(time)
|
|
33
|
-
|
|
34
|
-
// 计算相差天数
|
|
35
|
-
const diff = Math.abs(current.diff(start, 'day'))
|
|
36
|
-
|
|
37
|
-
return diff > 15
|
|
38
|
-
}
|
|
39
|
-
</script>
|