嵌套路由中动态添加子路由

import Router from 'vue-router'

获取当前路由

let allRouter=this.$router.options.routes
      allRouter[8].children.push({path: '/detail/'+billNo,component: () => import('@/views/homepage/detail/index'),name: 'Detail'+billNo,hidden: true,meta: { title: '详情页('+billNo+')', icon: 'user', affix: true }})//替换以前的 router 保证名字不重复this.$router.matcher = new Router({ mode: "hash" }).matcherthis.$router.addRoutes(allRouter)

跳转到新路由页面

      this.$router.push({path: '/detail/'+billNo,query: {billNo: billNo,shipCompany: shipCompany}})

参考
https://blog.csdn.net/weixin_44680009/article/details/120924575


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部