一
script裏面動態操作routers裏面的配置可以用 this.
1-this.
3-this.$router.matched //當前路由匹配項(爲對象)
以name爲例
<li v-for="item in matched "></li>
methods:{
this.matched = this.$route.matched.filter(item => item.name);
}
如上代碼,可以拿到routers裏面配置的一些列信息,動態顯示到HTML中。