小程序版本更新后点击出现问题
发布于 5 年前 作者 jialei 2921 次浏览 来自 官方Issues
  • 当前 Bug 的表现(可附上截图)

我在项目中加入自动更新的代码之后,有时进入小程序其中一个页面的wx.showModal()方法点击不出来,按系统返回键就会打印出’用户点击取消’,就是下面方法中的wx.showModal()的取消事件, 不知道怎么回事啊!!! 就大神帮忙看看

// 那个页面的点击事件

set_scene: function(e) {

let self = this

let name = e.currentTarget.dataset.name

let hardwareType = wx.getStorageSync(‘hardwareType’)

wx.showModal({

title: ‘提示’,

content: ‘是否将’ + name + ‘设置为主页面!’,

success(res) {

if (res.confirm) {

if (hardwareType == 0) {

let hardwareCode = wx.getStorageSync(“hardwareCode”)

let sign = self.getSign(hardwareCode)

let index = e.currentTarget.dataset.index + 1

let position = {

‘imei’: hardwareCode,

‘scene’: index,

‘sign’: sign,

“isPage”: “scene”

}

// 像硬件发送基本设置的内容

app.client.publish(’/TMHD/box_set’, JSON.stringify(position))

}

} else if (res.cancel) {

console.log(‘用户点击取消’)

}

}

})

},

// 这个是自动更新的方法

autoUpdate: function () {

var self = this

// 获取小程序更新机制兼容

if (wx.canIUse(‘getUpdateManager’)) {

const updateManager = wx.getUpdateManager()

//1. 检查小程序是否有新版本发布

updateManager.onCheckForUpdate(function (res) {

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

if (res.hasUpdate) {

//2. 小程序有新版本,则静默下载新版本,做好更新准备

updateManager.onUpdateReady(function () {

updateManager.applyUpdate()

})

updateManager.onUpdateFailed(function () {

// 新的版本下载失败

wx.showModal({

title: ‘已经有新版本了哟~’,

content: ‘新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~’,

})

})

}

})

} else {

// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示

wx.showModal({

title: ‘提示’,

content: ‘当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。’

})

}

},

1 回复

你好,是Android端的问题还是iOS端的问题?

回到顶部