u
This commit is contained in:
1 parent
f572dce2f6
commit
e99a9fb274
356 files changed
+28877
-1055
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<script setup lang="ts">
|
||||
// disabledDate 禁用日期;clearable 提供清除按钮;timeDefault 控制无值时的默认时间
|
||||
import { ref } from 'vue'
|
||||
import { G3DatePicker, G3Space } from '@g3soft/ui'
|
||||
|
||||
const future = ref('')
|
||||
const locked = ref('2026-10-31 23:59:59')
|
||||
|
||||
// 只能选今天之后(含今天)
|
||||
function disabledPast(date: Date) {
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
return date.getTime() < today.getTime()
|
||||
}
|
||||
|
||||
// 禁用周末
|
||||
function disabledWeekend(date: Date) {
|
||||
return date.getDay() === 0 || date.getDay() === 6
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<G3Space direction="vertical" :size="12" style="display: flex; width: 280px">
|
||||
<G3DatePicker v-model="future" :disabled-date="disabledPast" placeholder="只能选今天及以后" />
|
||||
|
||||
<G3DatePicker
|
||||
v-model="future"
|
||||
:disabled-date="disabledWeekend"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
time-default="end"
|
||||
placeholder="只能选工作日,默认 23:59"
|
||||
/>
|
||||
|
||||
<G3DatePicker v-model="locked" disabled placeholder="禁用态" />
|
||||
</G3Space>
|
||||
</template>
|
||||
Reference in new issue
Block a user