vue2.0 设置router.go('/goods')会不停的刷新页面

代码如下

let routes = [
  {
    path: '/goods', component: goods
  },
  {
    path: '/ratings', component: ratings
  },
  {
    path: '/sellers', component: sellers
  }
]
const router = new VueRouter({
  routes,
  linkActiveClass: 'active'
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

router.go('/goods')

vue 1.0版本版本使用router.go('/goods'),但是在2.0中是用router.push(‘/goods’),成了这个router.push ,据说是为了和history api 保持一致

猜你喜欢

转载自blog.csdn.net/weixin_38606332/article/details/80869635