hookehuyr

perf(打卡页面): 使用splice替代filter优化删除性能

style(日历组件): 修正缩进格式
1 <!-- 1 <!--
2 * @Date: 2025-01-25 15:34:17 2 * @Date: 2025-01-25 15:34:17
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-12-18 23:38:02 4 + * @LastEditTime: 2025-12-18 23:45:18
5 * @FilePath: /mlaj/src/components/ui/CollapsibleCalendar.vue 5 * @FilePath: /mlaj/src/components/ui/CollapsibleCalendar.vue
6 * @Description: 可折叠日历组件 6 * @Description: 可折叠日历组件
7 --> 7 -->
...@@ -208,7 +208,7 @@ watch(y, (newY) => { ...@@ -208,7 +208,7 @@ watch(y, (newY) => {
208 // 只有当向上滚动超过一定距离或者不在底部反弹区域时才显示 208 // 只有当向上滚动超过一定距离或者不在底部反弹区域时才显示
209 // 这里的判断其实已经被上面的触底检测覆盖了一部分,但为了保险,可以加一个最小变动阈值 209 // 这里的判断其实已经被上面的触底检测覆盖了一部分,但为了保险,可以加一个最小变动阈值
210 if (Math.abs(newY - lastY.value) > 5) { 210 if (Math.abs(newY - lastY.value) > 5) {
211 - isHeaderHidden.value = false 211 + isHeaderHidden.value = false
212 } 212 }
213 } 213 }
214 214
......
1 <!-- 1 <!--
2 * @Date: 2025-05-29 15:34:17 2 * @Date: 2025-05-29 15:34:17
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-12-18 22:58:48 4 + * @LastEditTime: 2025-12-18 23:48:47
5 * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue 5 * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -517,9 +517,14 @@ const delCheckin = (post) => { ...@@ -517,9 +517,14 @@ const delCheckin = (post) => {
517 if (code) { 517 if (code) {
518 // 删除成功后,刷新页面 518 // 删除成功后,刷新页面
519 showSuccessToast('删除成功'); 519 showSuccessToast('删除成功');
520 - // router.go(0); 520 +
521 - // 删除post_id相应的数据 521 + // 优化:使用 splice 替代 filter,避免大数组重新分配内存,性能更好
522 - checkinDataList.value = checkinDataList.value.filter(item => item.id !== post.id); 522 + // checkinDataList.value = checkinDataList.value.filter(item => item.id !== post.id);
523 + const index = checkinDataList.value.findIndex(item => item.id === post.id);
524 + if (index > -1) {
525 + checkinDataList.value.splice(index, 1);
526 + }
527 +
523 // 检查是否还可以打卡 528 // 检查是否还可以打卡
524 const current_date = route.query.date; 529 const current_date = route.query.date;
525 if (current_date) { 530 if (current_date) {
......