1、首先,在主页或app.vue中使用plus.runtime.getProperty()获取到app的当前wgt包版本号。 2、然后,通过后端返回给你的接口里有一个版本号(需要手动去后台管理系统中上传一个wgt包,并输入这个wgt包的版本号)。 3、再之后,将这个版本号与app当前版本号进行对比,若当前版本号大于后端给你的版本号,就不升级,反之,...
plus.runtime.getProperty(plus.runtime.appid, function(inf) { callback && callback({ versionCode: inf.versionCode,//inf.versionCode资源版本号,plus.runtime.versionCode为应用版本号 versionName: inf.version }); }); } // 发起ajax请求获取服务端版本号 ...
plus.runtime.version 或者 uni.getSystemInfo() 读取到的是 apk/ipa 包的版本号,而非 manifest.json 资源中的版本信息,所以这里用 plus.runtime.getProperty() 来获取相关信息。 安装wgt 资源包成功后,必须执行 plus.runtime.restart(),否则新的内容并不会生效。 如果App的原生引擎不升级,只升级wgt包时需要注...
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => { that.version = wgtinfo.version //客户端版本号 console.log('当前app版本信息:' + that.version); }) that.getUpdateVersion() }, getUpdateVersion() { let that = this; // 获取当前app版本信息 that.$req.get("/appUpdate/queryUpd...
plus.runtime.getProperty(plus.runtime.appid, function(inf) { //此处处理获取版本号的方法是:版本名称与版本号之间是有命名规则的,如果版本名称可以正则获取到版本号,然后进行回调处理即可。 let versionreplace = inf.version.replace(/\./g,'');
runtime.getProperty(plus.runtime.appid, widgetInfo => { phoneInfo.manifestInfo = widgetInfo; uni.setStorageSync('widgetInfo', widgetInfo); }); } //#endif } }; </script> 最后,你还可以尝试了解 App升级中心 uni-upgrade-center。 本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => { const currentVersion = widgetInfo.version; this.requestNewVersionInfo(currentVersion); }); }, requestNewVersionInfo(currentVersion) { // 请求你的后台接口获取最新版本信息 uni.request({ ...
1.uni-app打包成apk或wgt⽂件,使⽤plus.runtime.getProperty⽅法获取本地应⽤资源版本号。2.调⽤后端接⼝,拿到与后端规定好的版本号,与前⾯获取的版本号进⾏对⽐,如果不⼀致(也可以判断当前版本号是否⼩于线上版本号,也就是最新版本号),进⾏下⼀步操作。3.uni.showModal或其他...
plus.runtime.version或者uni.getSystemInfo()读取到的是apk/ipa包的版本号,而非manifest.json资源中的版本信息,所以这里用plus.runtime.getProperty()来获取相关信息。 ⚠️安装wgt资源包成功后,必须执行plus.runtime.restart(),否则新的内容并不会生效。
plus.runtime.getProperty(plus.runtime.appid,function(inf){ console.log(inf.version) }); 我们用此API获取到的版本号去数据库比对(前方伪代码): // 比对版本方法, 此方法网友提供,侵权删除 const compare = (curV, reqV) => { if (curV && reqV) { ...