index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // pages/home/index.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. height: app.globalData.height * 2 + 25,
  9. windowHeight: app.globalData.windowHeight,
  10. navbarData: {
  11. name: '卡路里计算'
  12. },
  13. form: {}
  14. },
  15. // 提交
  16. formSubmit: function (e) {
  17. // console.log('form发生了submit事件,携带数据为:', e.detail.value)
  18. },
  19. // 重置
  20. formReset: function (e) {
  21. // console.log('form发生了reset事件,携带数据为:', e.detail.value)
  22. this.setData({ form: {} })
  23. },
  24. // 返回页面
  25. back() {
  26. wx.switchTab({
  27. url: '/pages/home/index',
  28. })
  29. },
  30. /**
  31. * 生命周期函数--监听页面加载
  32. */
  33. onLoad: function (options) {
  34. },
  35. /**
  36. * 生命周期函数--监听页面初次渲染完成
  37. */
  38. onReady: function () {
  39. },
  40. /**
  41. * 生命周期函数--监听页面显示
  42. */
  43. onShow: function () {
  44. // if (typeof this.getTabBar === 'function' &&
  45. // this.getTabBar()) {
  46. // this.getTabBar().setData({
  47. // selected: 3
  48. // })
  49. // }
  50. },
  51. /**
  52. * 生命周期函数--监听页面隐藏
  53. */
  54. onHide: function () {
  55. },
  56. /**
  57. * 生命周期函数--监听页面卸载
  58. */
  59. onUnload: function () {
  60. },
  61. /**
  62. * 页面相关事件处理函数--监听用户下拉动作
  63. */
  64. onPullDownRefresh: function () {
  65. },
  66. /**
  67. * 页面上拉触底事件的处理函数
  68. */
  69. onReachBottom: function () {
  70. },
  71. /**
  72. * 用户点击右上角分享
  73. */
  74. onShareAppMessage: function () {
  75. }
  76. })