Showing
2 changed files
with
8 additions
and
4 deletions
| ... | @@ -124,6 +124,7 @@ const onVideoDetail = (v) => { | ... | @@ -124,6 +124,7 @@ const onVideoDetail = (v) => { |
| 124 | // 删除个人首页的keep-alive缓存 | 124 | // 删除个人首页的keep-alive缓存 |
| 125 | if (!$route.query.type) { // read-only 页不能删除 | 125 | if (!$route.query.type) { // read-only 页不能删除 |
| 126 | store.removeThisPage('personIndex'); | 126 | store.removeThisPage('personIndex'); |
| 127 | + store.changeScrollTopPerson(0); // 清空个人首页记录位置 | ||
| 127 | } | 128 | } |
| 128 | </script> | 129 | </script> |
| 129 | 130 | ... | ... |
| ... | @@ -77,7 +77,7 @@ import icon_avatar from '@images/que-touxiang@2x.png' | ... | @@ -77,7 +77,7 @@ import icon_avatar from '@images/que-touxiang@2x.png' |
| 77 | import MyButton from '@/components/MyButton/index.vue' | 77 | import MyButton from '@/components/MyButton/index.vue' |
| 78 | 78 | ||
| 79 | import { ref, reactive, onMounted } from 'vue' | 79 | import { ref, reactive, onMounted } from 'vue' |
| 80 | -import { useRoute, useRouter } from 'vue-router' | 80 | +import { onBeforeRouteLeave, useRoute, useRouter } from 'vue-router' |
| 81 | import axios from '@/utils/axios'; | 81 | import axios from '@/utils/axios'; |
| 82 | import $ from 'jquery' | 82 | import $ from 'jquery' |
| 83 | import _ from 'lodash' | 83 | import _ from 'lodash' |
| ... | @@ -89,6 +89,12 @@ const $router = useRouter(); | ... | @@ -89,6 +89,12 @@ const $router = useRouter(); |
| 89 | const store = mainStore(); | 89 | const store = mainStore(); |
| 90 | store.changeKeepPages('clear'); | 90 | store.changeKeepPages('clear'); |
| 91 | 91 | ||
| 92 | +// onBeforeRouteLeave(() => { | ||
| 93 | + // 重置位置缓存 | ||
| 94 | + // store.changeScrollTopCollection(0); | ||
| 95 | + // store.changeScrollTopLike(0); | ||
| 96 | +// }) | ||
| 97 | + | ||
| 92 | /********** 切换用户功能 START *************/ | 98 | /********** 切换用户功能 START *************/ |
| 93 | 99 | ||
| 94 | const show = ref(false); | 100 | const show = ref(false); |
| ... | @@ -314,9 +320,6 @@ export default { | ... | @@ -314,9 +320,6 @@ export default { |
| 314 | } | 320 | } |
| 315 | }, | 321 | }, |
| 316 | mounted() { | 322 | mounted() { |
| 317 | - // 重置位置缓存 | ||
| 318 | - Cookies.set('scrollTopCollection', 0); | ||
| 319 | - Cookies.set('scrollTopLike', 0); | ||
| 320 | }, | 323 | }, |
| 321 | methods: { | 324 | methods: { |
| 322 | 325 | ... | ... |
-
Please register or login to post a comment