Problem Description:
- Realize page refresh and jump to the home page in vue
- Refresh back to top
- Refreshing the jump page in the project is affected by the scrolling distance of the previous page browsing
Solution:
- In app.vue
mounted() {
// 刷新后跳转到首页面
this.$router.push("/");
//刷新后回到顶部
window.addEventListener("beforeunload", (e) => {
window.scroll(0, 0);
});
},