version.ts 1.5 KB

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