version.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // pages/version/version.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. update: false
  8. },
  9. update() {
  10. if (wx.getUpdateManager) {
  11. const updateManager = wx.getUpdateManager();
  12. updateManager.onCheckForUpdate(res => {
  13. if (res.hasUpdate) {
  14. updateManager.onUpdateReady(res => {
  15. updateManager.applyUpdate()
  16. })
  17. updateManager.onUpdateFailed(res => {
  18. wx.showModal({
  19. title: '更新提示',
  20. content: '请删除当前小程序,重新搜索进入',
  21. showCancel: false,
  22. })
  23. })
  24. }
  25. })
  26. } else {
  27. wx.showModal({
  28. title: '更新提示',
  29. content: '请删除当前小程序,重新搜索进入',
  30. showCancel: false,
  31. })
  32. }
  33. },
  34. /**
  35. * 生命周期函数--监听页面加载
  36. */
  37. onLoad: function(options) {
  38. },
  39. /**
  40. * 生命周期函数--监听页面初次渲染完成
  41. */
  42. onReady: function() {
  43. },
  44. /**
  45. * 生命周期函数--监听页面显示
  46. */
  47. onShow: function() {
  48. },
  49. /**
  50. * 生命周期函数--监听页面隐藏
  51. */
  52. onHide: function() {
  53. },
  54. /**
  55. * 生命周期函数--监听页面卸载
  56. */
  57. onUnload: function() {
  58. },
  59. /**
  60. * 页面相关事件处理函数--监听用户下拉动作
  61. */
  62. onPullDownRefresh: function() {
  63. },
  64. /**
  65. * 页面上拉触底事件的处理函数
  66. */
  67. onReachBottom: function() {
  68. },
  69. /**
  70. * 用户点击右上角分享
  71. */
  72. onShareAppMessage: function() {
  73. }
  74. })