diff --git a/src/router/index.js b/src/router/index.js index af8afd7..dc1888b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -113,5 +113,7 @@ const router = createRouter({ history: createWebHistory(process.env.BASE_URL), routes }) - +router.afterEach(() => { + window.scrollTo(0,0); +}) export default router diff --git a/src/views/pages/article.vue b/src/views/pages/article.vue index b908a06..fd83d0f 100644 --- a/src/views/pages/article.vue +++ b/src/views/pages/article.vue @@ -79,6 +79,7 @@ }, methods:{ getData(id){ + this.$router.push({path:'/article',query:{id:id}}) this.$http.post(`/door/getArt/${id}`).then(res=>{ this.datObj = res.data.data this.datObj.content = this.datObj.content&&this.datObj.content.replace(/{ return ele.name==this.datObj.category.categoryName