home.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. // pages/home/home.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. name:"图图",
  8. users: "小明",
  9. list:[
  10. {
  11. id:1,
  12. name:"孙悟空",
  13. desc:"金箍棒"
  14. },
  15. {
  16. id:2,
  17. name:"猪八戒",
  18. desc:"九齿钉耙"
  19. },
  20. {
  21. id:3,
  22. name:"图图",
  23. desc:"翻斗花园"
  24. }
  25. ],
  26. score: 50,
  27. background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
  28. indicatorDots: true,
  29. vertical: false,
  30. autoplay: true,
  31. interval: 2000,
  32. duration: 500
  33. },
  34. handleChange: function() {
  35. console.log("触碰了")
  36. this.setData({
  37. name:"哆啦A梦"
  38. })
  39. },
  40. goDetail(event) {
  41. console.log('x',event)
  42. wx.navigateTo({
  43. url: `/pages/detail/detail?id=${event.target.dataset.id}`,
  44. })
  45. },
  46. handleRead() {
  47. console.log(wx.getStorageSync('username'))
  48. },
  49. handleShow() {
  50. // wx.showToast({
  51. // title: '你好',
  52. // icon:'error'
  53. // })
  54. wx.setStorageSync('username', '小强')
  55. },
  56. handleJump() {
  57. console.log("你好")
  58. // wx.navigateTo({
  59. // url: '/pages/detail/detail',
  60. // })
  61. // wx.redirectTo({
  62. // url: '/pages/detail/detail',
  63. // })
  64. // wx.switchTab({
  65. // url: '/pages/list/list',
  66. // })
  67. wx.reLaunch({
  68. url: '/pages/list/list',
  69. })
  70. },
  71. handleInput(e) {
  72. // console.log(e,'eeee')
  73. const key = e.detail.value;
  74. this.setData({
  75. users: key
  76. })
  77. console.log(this.data.users,'sss')
  78. },
  79. handleChange(e) {
  80. console.log(e)
  81. },
  82. handleScore:function() {
  83. console.log(this.data.score,'分数')
  84. this.setData({
  85. score: this.data.score + 10
  86. })
  87. },
  88. handleBox: function() {
  89. console.log("box")
  90. },
  91. handleBox1: function() {
  92. console.log("box1")
  93. },
  94. /**
  95. * 生命周期函数--监听页面加载
  96. */
  97. onLoad(options) {
  98. console.log("111")
  99. },
  100. /**
  101. * 生命周期函数--监听页面初次渲染完成
  102. */
  103. onReady() {
  104. console.log("222")
  105. },
  106. /**
  107. * 生命周期函数--监听页面显示
  108. */
  109. onShow() {
  110. console.log("333")
  111. },
  112. /**
  113. * 生命周期函数--监听页面隐藏
  114. */
  115. onHide() {
  116. console.log("444")
  117. },
  118. /**
  119. * 生命周期函数--监听页面卸载
  120. */
  121. onUnload() {
  122. console.log("555")
  123. },
  124. /**
  125. * 页面相关事件处理函数--监听用户下拉动作
  126. */
  127. onPullDownRefresh() {
  128. console.log("666")
  129. },
  130. /**
  131. * 页面上拉触底事件的处理函数
  132. */
  133. onReachBottom() {
  134. },
  135. /**
  136. * 用户点击右上角分享
  137. */
  138. onShareAppMessage() {
  139. }
  140. })