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
    }
  }

 

Logo

前往低代码交流专区

更多推荐