vue 解决路由跳转页面下移

 

import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'

Vue.use(Router)

export default new Router({
  // mode: process.env.VUE_APP_TESE == 1 && process.env.VUE_APP_BUILD == 1 ? 'hash' : 'history',
  mode: 'history',
  // base: '/dongfeng/html/post',
  routes: [

  ],
  // 解决路由跳页页面下移动问题
  scrollBehavior (to, from, savedPosition) {
    if (to.name != 'fmHome' && to.name != 'circleIndex' && to.name != 'explore' && to.name != 'fanMoney' && to.name != 'activity' && to.name != 'retrospect' && to.name != 'productionPart' && to.name != 'searchPost' && to.name != 'carSystem' && to.name != 'fmMoneyGoods') {
      window.scrollTo(0, 0);
    }
  }
})

 

posted @ 2020-04-20 16:15  本溢  阅读(447)  评论(0)    收藏  举报