vue获取当前路由的子路由列表
this.$router:获取全局路由this.$route:获取当前路由信息computed: {// 获取当前路由的子路由routes(){var routes = {children: this.$router.options.routes};var route = this.$route.mat...
·
this.$router:获取全局路由
this.$route:获取当前路由信息
computed: {
// 获取当前路由的子路由
routes(){
var routes = {
children: this.$router.options.routes
};
var route = this.$route.matched;
for(var i=0; i<route.length-1; i++){
routes = routes.children.find((e) => (e.name == route[i].name));
}
return routes.children
}
}
更多推荐
已为社区贡献11条内容
所有评论(0)