美文网首页
判断版本

判断版本

作者: 不不作为 | 来源:发表于2022-03-24 16:50 被阅读0次
 //版本判断
    judgeVersion(){
        var browser = {
            versions: function () {
                var u = navigator.userAgent,
                    app = navigator.appVersion;
                return { //移动终端浏览器版本信息   
                    ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端  
                    android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器  
                    iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器  
                };
            }(),
            language: (navigator.browserLanguage || navigator.language).toLowerCase()
        }
        var android = browser.versions.android;
        var iOS = browser.versions.ios;
        if(android){
          if(this.$route.query.versionNo < 230){   //如果安卓版本小于 230  提示弹窗
            this.dialog()
          }
        }else if(iOS){
           const version = this.$route.query.versionNo; //苹果版本号
           const targetVersion = '5.6.1'  // 苹果版本号与此版本号对比 
           const verCurr = version.split('.')
           const tarCurr = targetVersion.split('.')
           console.log(verCurr)
           for (let i = 0 ; i < verCurr.length ; i++){
              if(parseInt(verCurr[i]) < parseInt(tarCurr[i])){ // 如皋当前版本号小于目标版本  弹窗
                this.dialog()
              }
           }
        }
    },
    dialog(){
        Dialog.confirm({
          title:'提示',
          message: '若想办理赎回业务,请您更新为最新版本!',
          showConfirmButton: false,
          cancelButtonText: "我知道了",
          cancelButtonColor:'#EF2727'
        })
        .then(() => {
          // on confirm
        })
        .catch(() => {
          // on cancel
        });
    },

相关文章

  • 版本判断

    if OS_VERSION < 8 是编译时判断, [[UIDevice currentDevice].syste...

  • 判断版本

  • 小滕VIP解析云端接口

    版本判断http://vip.jlsprh.com/index.php?url=版本判断

  • iOS 判断设备版本

    iOS版本判断

  • iOS 版本判断

    苹果新出的版本号判断,不用在获取当前设备了。 iOS 11 scrollView偏移64px 判断当前系统大于等于...

  • iOS版本判断

    ♪ Xcode中版本相关的配置项 1. Base SDK 简单来说它表示的是Xcode可以支持的最高版本,即app...

  • 判断当前版本

    判定系统版本: double version = [[UIDevice currentDevice].system...

  • iOS版本判断

    做iOS版本适配的时候,因为有些API是在新的版本里才出现的,所以需要做版本的判断。下面就说一下iOS提供的几个版...

  • WebView版本判断

    通过user-agent来区分webview版本例:Mozilla/5.0 (Linux; U; Android ...

  • #define判断版本

    iOS系统类库里面有一个Availability.h头文件,有一些宏定义。 #define __IPHONE_2_...

网友评论

      本文标题:判断版本

      本文链接:https://www.haomeiwen.com/subject/giqljrtx.html