最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

Vue IOS端跳转后返回页面不刷新问题解决

业界 admin 4浏览 0评论

方法一: we码用了,生效

mounted () {
    this.$nextTick(()=>{
    //首页跳转至门诊或者商城返回 IOS不兼容页面自动刷新问题
    var u = navigator.userAgent,
    app = navigator.appVersion;
    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    if(isiOS){
      window.onpageshow = function(event) {
      if (event.persisted) {
          window.location.reload()
      }
      };
    }
    })
  },

方法二:

mounted(){
    var _this = this;
    window.addEventListener('pageshow',function(){
      if(_this.isPageHide) {
        window.location.reload();
      }
    });
    window.addEventListener('pagehide', function(){
      _this.isPageHide = true;
    });
}

方法一: we码用了,生效

mounted () {
    this.$nextTick(()=>{
    //首页跳转至门诊或者商城返回 IOS不兼容页面自动刷新问题
    var u = navigator.userAgent,
    app = navigator.appVersion;
    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    if(isiOS){
      window.onpageshow = function(event) {
      if (event.persisted) {
          window.location.reload()
      }
      };
    }
    })
  },

方法二:

mounted(){
    var _this = this;
    window.addEventListener('pageshow',function(){
      if(_this.isPageHide) {
        window.location.reload();
      }
    });
    window.addEventListener('pagehide', function(){
      _this.isPageHide = true;
    });
}
发布评论

评论列表 (0)

  1. 暂无评论