data() {
return {
id: '',
}
},
mounted() {
this.id = this.$route.query.id
this.get_detail() // 获取该路由页面内容的方法
},
watch: {
$route(to, from) {
// console.log(to)
this.id = this.$route.query.id
this.get_detail()
},
},
在watch里面监听路由的跳转,获取to过去的新路由携带的id