home.js 2.3 KB

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