情况:
二级菜单下有多个三级菜单,三级菜单使用同一组件,但是参数不同
在二级菜单上添加了router-view
<template>
//看情况而定是否添加Math.random()
<router-view :key="this.$router.fullpath+Math.random()"/>
</template>
在公用组件上用watch监听路由
watch:{
$route:{
handler:function(val,odlVal){//路由更新要重新执行的代码,重新获取数据
this.getData();
}
}
},
mounted() {
this.getData();
},
methods: {
async getData() {
xxxx
}}