首页 > 解决方案 > 当我调用 this.$router.push() 时浏览器挂起

问题描述

我正在使用 Nuxt.js,我有一个触发 this.$router.push({ name: 'profile-info' }) 的按钮

// 路由器.js

...
export const routerOptions = {
  mode: 'history',
  base: decodeURI('/'),
  linkActiveClass: 'nuxt-link-active',
  linkExactActiveClass: 'nuxt-link-exact-active',
  scrollBehavior,

  routes: [{
    path: "/profile",
    component: _21560a2a,
    name: "profile",
    children: [{
      path: "info",
      component: _7cf67dd8,
      name: "profile-info"
    }]
  }, {
    path: "/",
    component: _4ca319da,
    name: "index"
  }],

  fallback: false
}
...

所以当我触发 this.$router.push 时,浏览器只是挂起,我必须强行关闭浏览器,因为我无法关闭选项卡。

在chrome dev工具中,在network选项卡中,页面的js文件只是pending然后超时

在此处输入图像描述

标签: vue.jsvue-routernuxt.js

解决方案


推荐阅读