开发者社区> 问答> 正文

vue-router 相同时报错?报错

Uncaught (in promise) t {_name: "NavigationDuplicated", name: "NavigationDuplicated"}

Router.prototype.push = function push (location) {

  return (() => {

    const push = originalPush.bind(this)

    try {

      console.log(location)

      push(location)

    } catch (err) {

      console.log(err)

    }

  })()

  // return originalPush.call(this, location).catch(err => err);

}

 

或 

 

const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(error=> error)
}     这个写法 总是报 catch undefined

 

或重新安装vue-router 依赖

都无用

展开
收起
爱吃鱼的程序员 2020-06-05 15:14:59 759 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        <p>vue已经修改了这个bug,你重新安装一下依赖</p>
                    
    
                        <p>请问报《总是报 catch undefined》的问题解决了吗</p>
    
    2020-06-05 15:15:09
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Vue.js 在前端服务化上的探索与实践 立即下载
利用编译将 Vue 组件转成 React 组件 立即下载
Vue.js在前端服务化上的实践与探索 立即下载