폼 눌러도 달력 나오게

This commit is contained in:
dyhj625 2025-03-20 16:02:50 +09:00
parent f3b7ae315f
commit 7d70aef38d
4 changed files with 109 additions and 22 deletions

View File

@ -520,6 +520,24 @@
/* project list */ /* project list */
.hidden-start-input {
position: absolute;
top: 103%;
left: 20%;
width: 100%;
height: 40px;
opacity: 0;
}
.hidden-end-input {
position: absolute;
top: 113.3%;
left: 20%;
width: 100%;
height: 40px;
opacity: 0;
}
.map { .map {
top: -160px; top: -160px;
left: -5px; left: -5px;

View File

@ -130,6 +130,8 @@
</div> </div>
</div> </div>
<!-- 시작일 -->
<div class="date-picker-wrapper" @click="focusStartDateInput">
<FormInput <FormInput
title="시작일" title="시작일"
type="date" type="date"
@ -138,7 +140,11 @@
:modelValue="selectedProject.PROJCTSTR" :modelValue="selectedProject.PROJCTSTR"
@update:modelValue="selectedProject.PROJCTSTR = $event" @update:modelValue="selectedProject.PROJCTSTR = $event"
/> />
<input ref="startDateInput" type="date" v-model="selectedProject.PROJCTSTR" class="hidden-start-input">
</div>
<!-- 종료일 -->
<div class="date-picker-wrapper" @click="focusEndDateInput">
<FormInput <FormInput
title="종료일" title="종료일"
type="date" type="date"
@ -147,6 +153,8 @@
:modelValue="selectedProject.PROJCTEND" :modelValue="selectedProject.PROJCTEND"
@update:modelValue="selectedProject.PROJCTEND = $event" @update:modelValue="selectedProject.PROJCTEND = $event"
/> />
<input ref="endDateInput" type="date" v-model="selectedProject.PROJCTEND" class="hidden-end-input">
</div>
<FormInput <FormInput
title="설명" title="설명"
@ -199,6 +207,31 @@ const toastStore = useToastStore();
const userStore = useUserInfoStore(); const userStore = useUserInfoStore();
const projectStore = useProjectStore(); const projectStore = useProjectStore();
const startDateInput = ref(null);
const endDateInput = ref(null);
const focusStartDateInput = () => {
nextTick(() => {
if (startDateInput.value) {
startDateInput.value.focus();
setTimeout(() => {
startDateInput.value.showPicker?.();
}, 50);
}
});
};
const focusEndDateInput = () => {
nextTick(() => {
if (endDateInput.value) {
endDateInput.value.focus();
setTimeout(() => {
endDateInput.value.showPicker?.();
}, 50);
}
});
};
// Props // Props
const props = defineProps({ const props = defineProps({
title: { title: {
@ -548,3 +581,13 @@ onMounted(async () => {
</script> </script>
<style>
.hidden-date-input {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 40px;
opacity: 0;
}
</style>

View File

@ -69,6 +69,7 @@
</div> </div>
</div> </div>
<div class="date-picker-wrapper" @click="focusStartDateInput">
<FormInput <FormInput
title="시작 일" title="시작 일"
name="startDay" name="startDay"
@ -77,15 +78,20 @@
:modelValue="startDay" :modelValue="startDay"
v-model="startDay" v-model="startDay"
/> />
<input ref="startDateInput" type="date" v-model="startDay" class="hidden-start-input">
</div>
<div class="date-picker-wrapper" @click="focusEndDateInput">
<FormInput <FormInput
title="종료 일" title="종료 일"
:type="'date'"
name="endDay" name="endDay"
:type="'date'"
:modelValue="endDay" :modelValue="endDay"
:min = "startDay" :min="startDay"
@update:modelValue="endDay = $event" @update:modelValue="endDay = $event"
/> />
<input ref="endDateInput" type="date" v-model="endDay" class="hidden-end-input">
</div>
<FormInput <FormInput
title="설명" title="설명"
@ -161,6 +167,31 @@
const nameAlert = ref(false); const nameAlert = ref(false);
const addressAlert = ref(false); const addressAlert = ref(false);
const startDateInput = ref(null);
const endDateInput = ref(null);
const focusStartDateInput = () => {
nextTick(() => {
if (startDateInput.value) {
startDateInput.value.focus();
setTimeout(() => {
startDateInput.value.showPicker?.();
}, 50);
}
});
};
const focusEndDateInput = () => {
nextTick(() => {
if (endDateInput.value) {
endDateInput.value.focus();
setTimeout(() => {
endDateInput.value.showPicker?.();
}, 50);
}
});
};
const addressData = ref({ const addressData = ref({
postcode: '', postcode: '',
address: '', address: '',

View File

@ -235,14 +235,9 @@ const goList = () => {
.item-input { .item-input {
max-width: 200px; max-width: 200px;
} }
.date-picker-wrapper {
position: relative;
display: inline-block;
width: 100%;
}
.hidden-date-input { .hidden-date-input {
position: absolute; position: absolute;
top: 31.5%; top: 28.5%;
left: 17%; left: 17%;
width: 100%; width: 100%;
opacity: 0; opacity: 0;