official-account.js 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // miniprogram/page/component/pages/official-account/official-account.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. theme: 'light',
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad() {
  13. this.setData({
  14. theme: wx.getSystemInfoSync().theme || 'light'
  15. })
  16. if (wx.onThemeChange) {
  17. wx.onThemeChange(({theme}) => {
  18. this.setData({theme})
  19. })
  20. }
  21. },
  22. /**
  23. * 生命周期函数--监听页面初次渲染完成
  24. */
  25. onReady() {
  26. },
  27. /**
  28. * 生命周期函数--监听页面显示
  29. */
  30. onShow() {
  31. },
  32. /**
  33. * 生命周期函数--监听页面隐藏
  34. */
  35. onHide() {
  36. },
  37. /**
  38. * 生命周期函数--监听页面卸载
  39. */
  40. onUnload() {
  41. },
  42. /**
  43. * 页面相关事件处理函数--监听用户下拉动作
  44. */
  45. onPullDownRefresh() {
  46. },
  47. /**
  48. * 页面上拉触底事件的处理函数
  49. */
  50. onReachBottom() {
  51. },
  52. /**
  53. * 用户点击右上角分享
  54. */
  55. onShareAppMessage() {
  56. }
  57. })