Vue 跳转相同路由实现 ,query 不同
方式一:
跳转
// 时间戳,防止跳转相同路由报错
const _time = Date.now()
// 跳转
this.$router.replace({
path: '/file/search/list',
query: { searchValue:'123', _time },
})
watch监听
watch: {
'$route.query': {
handler: function (val) {
const { searchValue} = val // 获取参数
this.parmas.searchValue = searchValue // 塞入查询条件
this.search() // 开始查询
},
immediate: true // 初次变化立即查询
}
},
原文链接:https://blog.youkuaiyun.com/qq_42339350/article/details/126991659