forked from verdnatura/salix-front
refs #6907 feat: add mouseEvent VnInputDate
This commit is contained in:
parent
c9cdb721d6
commit
926f3b6950
|
@ -16,6 +16,8 @@ const props = defineProps({
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const focus = ref(false);
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
|
@ -50,33 +52,30 @@ const styleAttrs = computed(() => {
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
});
|
});
|
||||||
|
function maxDate(date) {
|
||||||
|
const today = formatDate(new Date());
|
||||||
|
return date <= today;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QInput
|
<div @mouseover="focus = true" @mouseleave="focus = false">
|
||||||
class="vn-input-date"
|
<QInput
|
||||||
rounded
|
class="vn-input-date"
|
||||||
readonly
|
rounded
|
||||||
:model-value="toDate(value)"
|
readonly
|
||||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
:model-value="toDate(value)"
|
||||||
>
|
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||||
<template #append>
|
>
|
||||||
<QIcon name="event" class="cursor-pointer">
|
<template #append>
|
||||||
<QPopupProxy
|
<QIcon
|
||||||
v-model="isPopupOpen"
|
name="close"
|
||||||
cover
|
size="xs"
|
||||||
transition-show="scale"
|
v-if="focus && value"
|
||||||
transition-hide="scale"
|
@click="onDateUpdate(null)"
|
||||||
:no-parent-event="props.readonly"
|
></QIcon>
|
||||||
>
|
<QIcon name="event" class="cursor-pointer">
|
||||||
<QDate
|
<QPopupProxy
|
||||||
:model-value="formatDate(value)"
|
|
||||||
@update:model-value="onDateUpdate"
|
|
||||||
/>
|
|
||||||
</QPopupProxy>
|
|
||||||
</QIcon>
|
|
||||||
</template>
|
|
||||||
</QInput>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
Loading…
Reference in New Issue