0
0
Fork 0

refactor: refs #8019 create VnDate

This commit is contained in:
Jorge Penadés 2024-10-07 09:25:06 +02:00
parent 120f96fedc
commit 947f913679
3 changed files with 28 additions and 12 deletions

View File

@ -0,0 +1,11 @@
<script setup>
const model = defineModel({ type: [String, Number], required: true });
</script>
<template>
<QDate
v-model="model"
:landscape="$q.screen.gt.xs"
:today-btn="true"
:options="$attrs.options"
/>
</template>

View File

@ -3,6 +3,7 @@ import { onMounted, watch, computed, ref } from 'vue';
import { date } from 'quasar'; import { date } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useAttrs } from 'vue'; import { useAttrs } from 'vue';
import VnDate from './VnDate.vue';
const model = defineModel({ type: [String, Date] }); const model = defineModel({ type: [String, Date] });
const $props = defineProps({ const $props = defineProps({
@ -87,6 +88,11 @@ const styleAttrs = computed(() => {
} }
: {}; : {};
}); });
const manageDate = (date) => {
formattedDate.value = date;
isPopupOpen.value = false;
};
</script> </script>
<template> <template>
@ -129,6 +135,7 @@ const styleAttrs = computed(() => {
/> />
</template> </template>
<QMenu <QMenu
v-if="$q.screen.gt.xs"
transition-show="scale" transition-show="scale"
transition-hide="scale" transition-hide="scale"
v-model="isPopupOpen" v-model="isPopupOpen"
@ -137,19 +144,11 @@ const styleAttrs = computed(() => {
:no-focus="true" :no-focus="true"
:no-parent-event="true" :no-parent-event="true"
> >
<QDate <VnDate v-model="popupDate" @update:model-value="manageDate" />
v-model="popupDate"
:landscape="true"
:today-btn="true"
:options="$attrs.options"
@update:model-value="
(date) => {
formattedDate = date;
isPopupOpen = false;
}
"
/>
</QMenu> </QMenu>
<QDialog v-else v-model="isPopupOpen">
<VnDate v-model="popupDate" @update:model-value="manageDate" />
</QDialog>
</QInput> </QInput>
</div> </div>
</template> </template>

View File

@ -0,0 +1,6 @@
<script setup>
const model = defineModel({ type: [String, Number], required: true });
</script>
<template>
<QTime v-model="model" :landscape="$q.screen.gt.xs" now-btn mask="HH:mm" />
</template>