关于小程序版本升级提示安卓手机无提示框的问题?下面是代码
发布于 7 年前 作者 xiuyinghu 3649 次浏览 来自 问答

// 检测微信小程序版本,更新

updataVersion: function () {

if (wx.canIUse(“getUpdateManager”)) {

const updateManager = wx.getUpdateManager()

updateManager.onCheckForUpdate(function (res) {

// 请求完新版本信息的回调

console.log(res.hasUpdate,‘版本更新’)

})

updateManager.onUpdateReady(function () {

wx.showModal({

title: ‘更新提示’,

content: ‘新版本已经准备好,需要重启使用最新功能’,

showCancel: false,

confirmText: ‘知道了’,

success: function (res) {

if (res.confirm) {

// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启

updateManager.applyUpdate()

}

}

})

})

updateManager.onUpdateFailed(function () {

// 新的版本下载失败

wx.showModal({

title: ‘更新失败’,

content: ‘新版本更新失败了,请检查网络!’,

showCancel: false

});

})

}

}

3 回复

冷启动会触发,不是每次都会触发的

可能是刚启动的时候就已经是最新代码了

复现的机型以及微信版本,微信号,以及对应时间麻烦提供下,以及是否删除也拉不到最新的?

回到顶部