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; }; // 选择提醒