Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

能否根绝vue动态路由参数来设置此路由的component

image.png
在配置路由时,这个user组件能否根据前面的id来判断展示不同的组件,
比如user/1,component是组件1,user/2,component是组件2,目前采用的component is=,但是想直接在路由配置里去处理,有没有解决办法


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  1. 肯定要是路由钩子beforeEach,跳转之前处理;
  2. 可以使用跳转前addRoutes动态追回路由;
  3. 判断路由是否已经存在;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...