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
306 views
in Technique[技术] by (71.8m points)

Vue导航守卫的一个问题

图片.png
to.id是undefined的
to.params.id才是有效的
props不是已经绑定了吗?


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

1 Answer

0 votes
by (71.8m points)

props 是说你在子组件内,可以直接获取。

和 vue-router 的 beforeEach 关系不大,这里的 to 和 from 是对应的路由对象,并非是实例对象

http://jsrun.net/eHvKp/edit


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

...