index.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // nova-tourism/pages/my/my-card/index.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. statusBarHeight: 0,
  8. screenHeight: 0,
  9. customHeight: 0,
  10. bottomNavHeight: 0,
  11. contentHeight: 0,
  12. active: 0,
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. const systemInfo = wx.getSystemInfoSync();
  19. const statusBarHeight = systemInfo.statusBarHeight || 0;
  20. const screenHeight = systemInfo.screenHeight || 0;
  21. const custom = wx.getMenuButtonBoundingClientRect();
  22. const customHeight = custom.height + 10 + 2 || 0;
  23. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  24. const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  25. this.setData({
  26. statusBarHeight,
  27. screenHeight,
  28. customHeight,
  29. bottomNavHeight,
  30. contentHeight
  31. });
  32. },
  33. /**
  34. * 生命周期函数--监听页面初次渲染完成
  35. */
  36. onReady: function () {
  37. },
  38. /**
  39. * 生命周期函数--监听页面显示
  40. */
  41. onShow: function () {
  42. },
  43. /**
  44. * 生命周期函数--监听页面隐藏
  45. */
  46. onHide: function () {
  47. },
  48. /**
  49. * 生命周期函数--监听页面卸载
  50. */
  51. onUnload: function () {
  52. },
  53. /**
  54. * 页面相关事件处理函数--监听用户下拉动作
  55. */
  56. onPullDownRefresh: function () {
  57. },
  58. /**
  59. * 页面上拉触底事件的处理函数
  60. */
  61. onReachBottom: function () {
  62. },
  63. /**
  64. * 用户点击右上角分享
  65. */
  66. onShareAppMessage: function () {
  67. },
  68. onChange(event) {
  69. },
  70. })