hookehuyr

fix

1 <!-- 1 <!--
2 * @Date: 2023-06-21 10:23:09 2 * @Date: 2023-06-21 10:23:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-08-25 15:07:53 4 + * @LastEditTime: 2023-08-25 16:11:50
5 * @FilePath: /bieyuan/src/views/index.vue 5 * @FilePath: /bieyuan/src/views/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -200,6 +200,7 @@ const onConfirm = (dates) => { // 选择日历确定回调 ...@@ -200,6 +200,7 @@ const onConfirm = (dates) => { // 选择日历确定回调
200 dates.forEach((date) => { 200 dates.forEach((date) => {
201 selectedDates.value.push(dayjs(date).format('YYYY-MM-DD')); 201 selectedDates.value.push(dayjs(date).format('YYYY-MM-DD'));
202 }); 202 });
203 + localStorage.setItem('save_selected_dates', JSON.stringify(selectedDates.value));
203 clickNext(); 204 clickNext();
204 }; 205 };
205 206
......
...@@ -110,11 +110,15 @@ const handleCheck = (value) => { ...@@ -110,11 +110,15 @@ const handleCheck = (value) => {
110 value.checked = !value.checked; 110 value.checked = !value.checked;
111 // 同步日历显示 111 // 同步日历显示
112 defaultDate.value = []; 112 defaultDate.value = [];
113 + const arr = [];
113 shortcut.value.forEach((item) => { 114 shortcut.value.forEach((item) => {
114 if (item.checked) { 115 if (item.checked) {
115 defaultDate.value.push(dayjs(item.date).toDate()) 116 defaultDate.value.push(dayjs(item.date).toDate())
117 + arr.push(item.date);
116 } 118 }
117 }); 119 });
120 + // 缓存修改日期
121 + localStorage.setItem('save_selected_dates', JSON.stringify(arr));
118 } 122 }
119 123
120 const num = ref(1); 124 const num = ref(1);
...@@ -140,6 +144,17 @@ const showMore = async () => { ...@@ -140,6 +144,17 @@ const showMore = async () => {
140 asyncData.value.forEach(item => { 144 asyncData.value.forEach(item => {
141 item.format = item.date.split('-') 145 item.format = item.date.split('-')
142 }); 146 });
147 + // 同步日历显示
148 + defaultDate.value = [];
149 + // shortcut.value.forEach((item) => {
150 + // if (item.checked) {
151 + // defaultDate.value.push(dayjs(item.date).toDate())
152 + // }
153 + // });
154 + const arr = JSON.parse(localStorage.getItem('save_selected_dates'));
155 + arr.forEach((item) => {
156 + defaultDate.value.push(dayjs(item).toDate())
157 + });
143 } 158 }
144 159
145 const formatter = computed(() => { 160 const formatter = computed(() => {
......