转于此作者:
https://blog.csdn.net/weixin_43949587/article/details/106281394
查了很多博文,都没解决,唯独看到此文章,试了一下,就解决了头疼的事。
所 以问题都是next的问题,不知道next({ …to.path, replace:
true })这个语法干嘛,问题就出在这句话了,本人后来改成 next(to.path)这样,所有的问题都没有了 代码如下:
constantRoutes[0].children = routes
router.addRoutes(constantRoutes)
// next({ ...to.path, replace: true })
// 有详情也的可以使用fullpath
next(to.path)
亲测,真实有效