hookehuyr

fix

<!--
* @Date: 2023-06-21 10:23:09
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-08-25 15:07:53
* @LastEditTime: 2023-08-25 16:11:50
* @FilePath: /bieyuan/src/views/index.vue
* @Description: 文件描述
-->
......@@ -200,6 +200,7 @@ const onConfirm = (dates) => { // 选择日历确定回调
dates.forEach((date) => {
selectedDates.value.push(dayjs(date).format('YYYY-MM-DD'));
});
localStorage.setItem('save_selected_dates', JSON.stringify(selectedDates.value));
clickNext();
};
......
......@@ -110,11 +110,15 @@ const handleCheck = (value) => {
value.checked = !value.checked;
// 同步日历显示
defaultDate.value = [];
const arr = [];
shortcut.value.forEach((item) => {
if (item.checked) {
defaultDate.value.push(dayjs(item.date).toDate())
arr.push(item.date);
}
});
// 缓存修改日期
localStorage.setItem('save_selected_dates', JSON.stringify(arr));
}
const num = ref(1);
......@@ -140,6 +144,17 @@ const showMore = async () => {
asyncData.value.forEach(item => {
item.format = item.date.split('-')
});
// 同步日历显示
defaultDate.value = [];
// shortcut.value.forEach((item) => {
// if (item.checked) {
// defaultDate.value.push(dayjs(item.date).toDate())
// }
// });
const arr = JSON.parse(localStorage.getItem('save_selected_dates'));
arr.forEach((item) => {
defaultDate.value.push(dayjs(item).toDate())
});
}
const formatter = computed(() => {
......