xinggevip

Vue2.x Cli3.x控制滚动行为
官方https://router.vuejs.org/zh/guide/advanced/scroll-behav...
扫描右侧二维码阅读全文
28
2019/05

Vue2.x Cli3.x控制滚动行为

官方

https://router.vuejs.org/zh/guide/advanced/scroll-behavior.html#%E5%BC%82%E6%AD%A5%E6%BB%9A%E5%8A%A8

router.js

export const router = new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  scrollBehavior (to, from, savedPosition) {
      //滚动到指定类
      return {
        selector: '.hash'
      }
    
  },
})
Last modification:May 28th, 2019 at 11:55 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment