一、监听路由 watch: { // 方法1 //监听路由是否变化 '$route' (to, from) { if(to.query.id !== from.query.id){ this.id = to.query.id; this.init();//重新加载数据 } } } //方法 2 设置路径变化时的处理函数 watch: { '$route': { handler: 'init', immediate: true } } 二、添加key <router-view :key="$route.fullpath"></router-view>
参考原文
https://blog.csdn.net/weixin_43837268/article/details/104747109?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1.queryctrv2&spm=1001.2101.3001.4242.2&utm_relevant_index=4