国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - Is there any good way for vue to return to the previous route and keep the position unchanged?
滿天的星座
滿天的星座 2017-05-16 13:43:04
0
1
657

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.

滿天的星座
滿天的星座

reply all(1)
習(xí)慣沉默
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)
  }) 
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template