问题:
h5中有一个页面,作为跳转第三方支付的中转页,在该页面的mounted中 拿query中的参数调用一个回调进行跳转,但是到第三方页面左上角返回时又会再次重新调用该方法跳到第三方页面,用户没办法正常返回到h5其他页面
处理:
由于我是哈希路由,所以需要截取一下才能识别到,否则直接使用 url.toString() 是无法识别到query的
// 在mounted调用的回调中删掉目标参数
const url = new URL(window.location.href)
url.searchParams.delete('parent_order_no')
window.history.replaceState({}, '', url.toString().split('?')[0])
console.log(new URL(window.location.href), 'url')

2016

被折叠的 条评论
为什么被折叠?



