遍历_self.$router.options.routes获取到的路由表,字路由children属性显示不出来是什么原因?

我用_self.$router.options.routes获取路由表,然后想遍历表中的字路由,但是实际上children没有显示出来。
var localRouter = _self.$router.options.routes
console.dir(localRouter)打印结果如下:

clipboard.png
然后遍历这个表的时候
for(var q = 0;q<localRouter.length;q++){

console.dir(localRouter[q].children)

}
打印报出undefined
打断点看见,localRouter[q]只有两个属性,path和component
也就是说,遍历_self.$router.options.routes获得的路由时children属性没有了,是什么原因。

阅读 2.6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题