This commit is contained in:
parent
18d4be0ea2
commit
fedec76b62
|
@ -1,6 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
|
||||||
import isValidDate from 'filters/isValidDate';
|
import isValidDate from 'filters/isValidDate';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -17,7 +16,7 @@ const props = defineProps({
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const focus = ref(false);
|
const hover = ref(false);
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ const isPopupOpen = ref(false);
|
||||||
|
|
||||||
const onDateUpdate = (date) => {
|
const onDateUpdate = (date) => {
|
||||||
value.value = date;
|
value.value = date;
|
||||||
// isPopupOpen.value = false;
|
isPopupOpen.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const padDate = (value) => value.toString().padStart(2, '0');
|
const padDate = (value) => value.toString().padStart(2, '0');
|
||||||
|
@ -79,19 +78,19 @@ const styleAttrs = computed(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div @mouseover="focus = true" @mouseleave="focus = false">
|
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||||
<QInput
|
<QInput
|
||||||
class="vn-input-date"
|
class="vn-input-date"
|
||||||
rounded
|
|
||||||
readonly
|
readonly
|
||||||
:model-value="displayDate(value)"
|
:model-value="displayDate(value)"
|
||||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||||
|
@click="isPopupOpen = true"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
name="close"
|
name="close"
|
||||||
size="xs"
|
size="xs"
|
||||||
v-if="focus && value"
|
v-if="hover && value"
|
||||||
@click="onDateUpdate(null)"
|
@click="onDateUpdate(null)"
|
||||||
></QIcon>
|
></QIcon>
|
||||||
<QIcon name="event" class="cursor-pointer">
|
<QIcon name="event" class="cursor-pointer">
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import isValidDate from 'filters/isValidDate';
|
import isValidDate from 'filters/isValidDate';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
|
@ -20,7 +19,6 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
const focus = ref(false);
|
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
|
@ -68,23 +66,15 @@ const styleAttrs = computed(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- <div @mouseover="focus = true" @mouseleave="focus = false"> -->
|
|
||||||
<QInput
|
<QInput
|
||||||
class="vn-input-time"
|
class="vn-input-time"
|
||||||
readonly
|
readonly
|
||||||
:model-value="formatTime(value)"
|
:model-value="formatTime(value)"
|
||||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||||
@click="isPopupOpen = true"
|
@click="isPopupOpen = true"
|
||||||
:clearable="false"
|
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<!-- <QIcon
|
<QIcon name="schedule" class="cursor-pointer">
|
||||||
name="close"
|
|
||||||
size="xs"
|
|
||||||
v-if="focus && value"
|
|
||||||
@click="value = null"
|
|
||||||
></QIcon> -->
|
|
||||||
<QIcon name="event" class="cursor-pointer">
|
|
||||||
<QPopupProxy
|
<QPopupProxy
|
||||||
v-model="isPopupOpen"
|
v-model="isPopupOpen"
|
||||||
cover
|
cover
|
||||||
|
@ -117,7 +107,6 @@ const styleAttrs = computed(() => {
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</template>
|
</template>
|
||||||
</QInput>
|
</QInput>
|
||||||
<!-- </div> -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
Loading…
Reference in New Issue