1. Route jump and pass parameters
this.$router.push({
path:'/scenicStrategyList',query:{
typeCode:code}});
2. Although the next click or the current route will not refresh the current route, the route routing data has changed at this time. For example, the route routing data has changed at this time, so we use this point to use vue watch to detect Such a change and then re-request the data request interface to get the desired data
watch:{
'$route'(val, from) {
//监听到路由(参数)改变
// 拿到目标参数 val.query.typeCode 去再次请求数据接口
this.getStrategyList(val.query.typeCode)
}
},
Original link: https://blog.csdn.net/qq_35035975/article/details/107511444?spm=1001.2014.3001.5502
I'm Tudou, see you next time!