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,
|
||||
},
|
||||
});
|
||||
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">
|
||||
|
|
Loading…
Reference in New Issue