hookehuyr

fix(路由): 使用replace替代push避免历史记录重复

修改浏览器地址时使用router.replace替代router.push,防止在用户导航时在浏览器历史记录中添加多个重复条目
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-06-24 17:25:52 4 + * @LastEditTime: 2025-06-30 17:09:48
5 * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue 5 * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -477,7 +477,8 @@ const onSelectDay = (day) => { ...@@ -477,7 +477,8 @@ const onSelectDay = (day) => {
477 selectedDate.value = currentSelectedDate; 477 selectedDate.value = currentSelectedDate;
478 478
479 // 修改浏览器地址把当前的date加入地址栏, 页面不刷新 479 // 修改浏览器地址把当前的date加入地址栏, 页面不刷新
480 - router.push({ 480 + // 使用replace替代push,避免在浏览器历史记录中添加多个条目
481 + router.replace({
481 path: route.path, 482 path: route.path,
482 query: { 483 query: {
483 ...route.query, 484 ...route.query,
......
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-06-28 21:43:29 4 + * @LastEditTime: 2025-06-30 17:09:13
5 * @FilePath: /mlaj/src/views/teacher/checkinPage.vue 5 * @FilePath: /mlaj/src/views/teacher/checkinPage.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -547,7 +547,8 @@ const onSelectDay = (day) => { ...@@ -547,7 +547,8 @@ const onSelectDay = (day) => {
547 selectedDate.value = currentSelectedDate; 547 selectedDate.value = currentSelectedDate;
548 548
549 // 修改浏览器地址把当前的date加入地址栏, 页面不刷新 549 // 修改浏览器地址把当前的date加入地址栏, 页面不刷新
550 - router.push({ 550 + // 使用replace替代push,避免在浏览器历史记录中添加多个条目
551 + router.replace({
551 path: route.path, 552 path: route.path,
552 query: { 553 query: {
553 ...route.query, 554 ...route.query,
......