用this.$route.matched[0].path可以打印路由前缀
mounted() {
console.log(this.$route.matched[0].path);
this.path = this.$route.matched[0].path ? this.$route.matched[0].path : "/";
// this.path = this.$route.path;
},
注意:
选中首页“/”时 打印不出东西来
以下是路由表:子路由形式