0
0
Fork 0

refs #6907 feat: add mouseEvent VnInputDate

This commit is contained in:
Javier Segarra 2024-02-26 07:22:34 +01:00
parent c9cdb721d6
commit 926f3b6950
1 changed files with 23 additions and 24 deletions

View File

@ -16,6 +16,8 @@ const props = defineProps({
default: false,
},
});
const focus = ref(false);
const emit = defineEmits(['update:modelValue']);
const value = computed({
get() {
@ -50,9 +52,14 @@ const styleAttrs = computed(() => {
}
: {};
});
function maxDate(date) {
const today = formatDate(new Date());
return date <= today;
}
</script>
<template>
<div @mouseover="focus = true" @mouseleave="focus = false">
<QInput
class="vn-input-date"
rounded
@ -61,22 +68,14 @@ const styleAttrs = computed(() => {
v-bind="{ ...$attrs, ...styleAttrs }"
>
<template #append>
<QIcon
name="close"
size="xs"
v-if="focus && value"
@click="onDateUpdate(null)"
></QIcon>
<QIcon name="event" class="cursor-pointer">
<QPopupProxy
v-model="isPopupOpen"
cover
transition-show="scale"
transition-hide="scale"
:no-parent-event="props.readonly"
>
<QDate
:model-value="formatDate(value)"
@update:model-value="onDateUpdate"
/>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</template>
<style lang="scss">