app.js 750 B

1234567891011121314151617181920212223242526272829303132
  1. App({
  2. onLaunch: function () {
  3. const updateManager = wx.getUpdateManager()
  4. updateManager.onCheckForUpdate(function (res) {
  5. // 请求完新版本信息的回调
  6. })
  7. updateManager.onUpdateReady(function () {
  8. wx.showModal({
  9. title: '更新提示',
  10. content: '新版本已经准备好,是否重启应用?',
  11. success: function (res) {
  12. if (res.confirm) {
  13. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  14. updateManager.applyUpdate()
  15. }
  16. }
  17. })
  18. })
  19. updateManager.onUpdateFailed(function () {
  20. // 新版本下载失败
  21. })
  22. wx.cloud.init({
  23. traceUser: true
  24. })
  25. this.globalData = {}
  26. },
  27. })