feat(移动端): 移动端日期范围组件支持快捷查询 (#18094)

This commit is contained in:
dataeaseShu
2026-03-18 14:24:24 +08:00
committed by GitHub
parent 8c487b248e
commit 384f09ffb0

View File

@@ -463,6 +463,17 @@ const onConfirm = () => {
handleValueChange()
showDate.value = false
}
const showDateQuick = ref(false)
const showQuick = () => {
showDateQuick.value = true
}
const emitMobile = (_, val) => {
const [start, end] = val
selectValue.value = [start?.format('YYYY/MM/DD HH:mm:ss'), end?.format('YYYY/MM/DD HH:mm:ss')]
handleValueChange()
showDateQuick.value = false
}
onBeforeMount(() => {
init()
@@ -515,7 +526,19 @@ const formatDate = computed(() => {
:class="isRange && 'wl50'"
@click="showPopup"
/>
<div v-if="dvMainStore.mobileInPc && isRange" class="vant-mobile wr50" @click="showPopupRight" />
<div v-if="dvMainStore.mobileInPc && isRange" class="vant-mobile wr50" @click="showPopupRight">
<div class="quick-selection" @click.stop="showQuick"></div>
<van-popup teleport="body" position="bottom" v-model:show="showDateQuick">
<div
@click="ele.onClick({ emit: emitMobile })"
class="shortcuts-mobile"
v-for="ele in shortcuts"
:key="ele.text"
>
{{ ele.text }}
</div></van-popup
>
</div>
<van-popup
v-if="dvMainStore.mobileInPc"
teleport="body"
@@ -576,6 +599,20 @@ const formatDate = computed(() => {
left: auto;
right: 0;
width: 50%;
.quick-selection {
position: absolute;
top: 0px;
right: 10px;
width: 24px;
height: 32px;
z-index: 10;
}
}
}
.shortcuts-mobile {
padding: 10px;
text-align: center;
border-bottom: 1px solid #eee;
}
</style>