苏州建设工程交易中心网站,wordpress导航添加双语菜单,wordpress个人博客模板,wordpress 搜索引擎解决vue3 怎么做到路由跳转传参刷新后消失 解决路由跳转传参去除问题 想要跳转后根据参数显示对应的tab#xff0c;但url传参刷新会持续保留无法重置。 router.replace替换又会导致显示内容为router.replace后的#xff0c;传参目的丢失。 业务逻辑#xff1a; 完成对应操作…解决vue3 怎么做到路由跳转传参刷新后消失 解决路由跳转传参去除问题 想要跳转后根据参数显示对应的tab但url传参刷新会持续保留无法重置。 router.replace替换又会导致显示内容为router.replace后的传参目的丢失。 业务逻辑 完成对应操作后点击按钮返回指定页面recruit/enterprise/position页面 // 页面A
const handleCancel (hire) { // hire是否是众聘岗位router.push({ path: /recruit/enterprise/position, query: { hire: hire ? 1 : 0 } })
}// 页面B
const showHire (route.query?.hire - 0) || 0
const tab ref(showHire ? 4: 1)
if (showHire) history.replaceState({ ...route.query, hire: 0 }, , route.path)
// 更新浏览器历史记录不触发页面重新加载 ( 目的去除目标参数 )
// 参数完全不保留使用history.replaceState({}, , newUrl)传入{}空对象
// 不使用vue的话可以window.location.href.replace(/\?.*$/, )或者window.location.hash.replace(/\?.*$/, )获取路由参考于https://zhuanlan.zhihu.com/p/691957141奇迹天蝎 的文章