home.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // pages/home/home.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. name:"图图",
  8. list:[
  9. {
  10. name:"图图",
  11. age:3
  12. },
  13. {
  14. name:"Lucy",
  15. age:13
  16. },
  17. {
  18. name:"Tom",
  19. age:22
  20. }
  21. ],
  22. age: 19,
  23. background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
  24. indicatorDots: true,
  25. vertical: false,
  26. autoplay: false,
  27. interval: 2000,
  28. duration: 500
  29. },
  30. handleBox: function() {
  31. console.log("box")
  32. },
  33. handleBox1: function(event) {
  34. console.log(event,'wwww')
  35. console.log("box1")
  36. // event.stopPropagation();
  37. // event.cancleBubble = true;
  38. // event.preventDefault();
  39. // event.returnValue = false;
  40. },
  41. handleUser:function() {
  42. wx.setStorageSync('user', '图图')
  43. },
  44. getUser:function() {
  45. console.log(wx.getStorageSync('user'))
  46. },
  47. /**
  48. * 生命周期函数--监听页面加载
  49. * 页面加载时触发 一个页面只会调用一次
  50. */
  51. onLoad(options) {
  52. console.log("1")
  53. },
  54. /**
  55. * 生命周期函数--监听页面初次渲染完成
  56. * 一个页面只会触发一次
  57. */
  58. onReady() {
  59. console.log("2")
  60. },
  61. /**
  62. * 生命周期函数--监听页面显示
  63. * 页面显示 切入/切除时触发
  64. * 触发n次
  65. */
  66. onShow() {
  67. console.log('3')
  68. },
  69. /**
  70. * 生命周期函数--监听页面隐藏
  71. */
  72. onHide() {
  73. console.log("4");
  74. },
  75. /**
  76. * 生命周期函数--监听页面卸载
  77. */
  78. onUnload() {
  79. console.log("5")
  80. },
  81. /**
  82. * 页面相关事件处理函数--监听用户下拉动作
  83. */
  84. onPullDownRefresh() {
  85. console.log("6")
  86. },
  87. /**
  88. * 页面上拉触底事件的处理函数
  89. */
  90. onReachBottom() {
  91. },
  92. /**
  93. * 用户点击右上角分享
  94. */
  95. onShareAppMessage() {
  96. }
  97. })