Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
新增更新检查
Browse files Browse the repository at this point in the history
  • Loading branch information
mohuishou committed Mar 29, 2018
1 parent 79bb063 commit 48dbfbe
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,28 @@
onLaunch() {
this.getToken()
}
onShow() {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
console.log(res.hasUpdate)
})
updateManager.onUpdateReady(function() {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,请重启应用',
showCancel: false,
success: function(res) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
})
})
updateManager.onUpdateFailed(function() {
// 新的版本下载失败
console.log("新版本下载失败!");
})
}
// 微信登录
wxLogin() {
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit 48dbfbe

Please sign in to comment.