1、场景:h5页面在浏览器中,push路由,然后使用浏览器回退,又能回到原页面;
此时使用
带参数 this.$router.push({name: 'video', replace:true, query:{id}})
或this.$router.replace('/video?id='+ id);
或this.$router.replace('/video');
2、场景:在当前页面replace且需要重新请求接口或刷新方法时,使用
this.$router.replace('/video?id='+ id);
this.$router.go(0);
但在safair中无效,所以。。
const userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
const isOpera = userAgent.indexOf("Opera") > -1;
if (userAgent.indexOf("Safari") > -1) { //判断是否Safari浏览器
this.$router.push({name: 'video', query:{id}})
location.reload()
// window.open(href + '=' + id)
} else {
this.$router.replace('/video?id='+ id);
this.$router.go(0);
}
近期一直较忙,陆续补充更新,有问题望诸君指出,万分感激