vue h5 移动端各项目总结

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);
      }

 

 

 

近期一直较忙,陆续补充更新,有问题望诸君指出,万分感激

 

 

 

转载于:https://my.oschina.net/lpcysz/blog/3089842

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值