home.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. goDetail:function() {
  48. console.log("触发")
  49. wx.navigateTo({
  50. url: '/pages/detail/detail',
  51. })
  52. },
  53. goDetail1:function() {
  54. wx.redirectTo({
  55. url: '/pages/detail/detail',
  56. })
  57. },
  58. goMy:function() {
  59. wx.switchTab({
  60. url: '/pages/my/my',
  61. })
  62. },
  63. goMy2:function() {
  64. wx.reLaunch({
  65. url: '/pages/detail/detail',
  66. })
  67. },
  68. /**
  69. * 生命周期函数--监听页面加载
  70. * 页面加载时触发 一个页面只会调用一次
  71. */
  72. onLoad(options) {
  73. console.log("1")
  74. },
  75. /**
  76. * 生命周期函数--监听页面初次渲染完成
  77. * 一个页面只会触发一次
  78. */
  79. onReady() {
  80. console.log("2")
  81. },
  82. /**
  83. * 生命周期函数--监听页面显示
  84. * 页面显示 切入/切除时触发
  85. * 触发n次
  86. */
  87. onShow() {
  88. console.log('3')
  89. },
  90. /**
  91. * 生命周期函数--监听页面隐藏
  92. */
  93. onHide() {
  94. console.log("4");
  95. },
  96. /**
  97. * 生命周期函数--监听页面卸载
  98. */
  99. onUnload() {
  100. console.log("5")
  101. },
  102. /**
  103. * 页面相关事件处理函数--监听用户下拉动作
  104. */
  105. onPullDownRefresh() {
  106. console.log("6")
  107. },
  108. /**
  109. * 页面上拉触底事件的处理函数
  110. */
  111. onReachBottom() {
  112. },
  113. /**
  114. * 用户点击右上角分享
  115. */
  116. onShareAppMessage() {
  117. }
  118. })