From e5f7129d617ff4366903109b41a1bb933c318a21 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Mon, 3 Nov 2025 11:29:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=89=E6=8B=A9=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=97=A5=E7=A8=8B=E7=9A=84=E9=A2=91=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/add-event/index.vue | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/pages/add-event/index.vue b/pages/add-event/index.vue index b172f9a..e91b25e 100644 --- a/pages/add-event/index.vue +++ b/pages/add-event/index.vue @@ -49,7 +49,7 @@ - + {{ repeatText }} @@ -190,7 +190,7 @@ - + 重复设置 @@ -198,16 +198,16 @@ v-for="item in repeatOptions" :key="item.value" class="repeat-option" - :class="{ active: formData.repeat === item.value }" - @click="selectRepeat(item.value)" + :class="{ active: tempRepeat === item.value }" + @click="tempRepeat = item.value" > {{ item.label }} - + - - + + @@ -267,6 +267,9 @@ const showColorPicker = ref(false); const showRepeatPicker = ref(false); const showReminderPicker = ref(false); +// 临时数据(用于弹窗暂存) +const tempRepeat = ref('none'); + // 时间选择器相关 const hourOptions = Array.from({ length: 24 }, (_, i) => String(i).padStart(2, '0') + '时'); const minOptions = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, '0') + '分'); @@ -515,9 +518,25 @@ const selectColor = (color) => { formData.value.color = color; }; -// 选择重复 -const selectRepeat = (value) => { - formData.value.repeat = value; +// 打开重复选择弹窗 +const openRepeatPicker = () => { + // 打开弹窗时,将当前值复制到临时变量 + tempRepeat.value = formData.value.repeat; + showRepeatPicker.value = true; +}; + +// 取消重复选择 +const handleCancelRepeat = () => { + // 恢复原始值 + tempRepeat.value = formData.value.repeat; + showRepeatPicker.value = false; +}; + +// 确认重复选择 +const handleConfirmRepeat = () => { + // 将临时变量的值更新到表单数据 + formData.value.repeat = tempRepeat.value; + showRepeatPicker.value = false; }; // 选择提醒