Pull up to refresh to achieve paging. If there are many pages, click on a page in the list to go to details, and then return to the previous page from the details. The position cannot be changed, and the code will not be refreshed. Forget about using scrollBehavior. I use The one is hash mode. I have done something similar. I hope you can give me some advice.
習慣沉默2017-05-16 13:45:04
beforeRouteLeave(to, from, next){
let position = window.scrollY()
this.$store.commit('SAVE_POSITION', position) //离开路由时把位置存起来
}
Get the value in the page
mounted () {
this.$nextTick(function(){
let position = this.$store.state.position //返回页面取出来
window.scroll(0, position)
})
}