home.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // pages/home/home.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. week:"二",
  8. obj:{
  9. name:"小郑",
  10. age: 18
  11. },
  12. arr:[
  13. {
  14. name:"小红",
  15. age: 10
  16. },
  17. {
  18. name:"小黄",
  19. age: 20
  20. },
  21. {
  22. name:"小蓝",
  23. age: 30
  24. },
  25. ],
  26. background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
  27. indicatorDots: true,
  28. vertical: false,
  29. autoplay: false,
  30. interval: 2000,
  31. duration: 500
  32. },
  33. getMain:function() {
  34. console.log("你好",wx.getStorageSync('name'))
  35. },
  36. getAA:function() {
  37. console.log("11")
  38. },
  39. getBB:function() {
  40. console.log("22")
  41. },
  42. getCC:function(event) {
  43. console.log(event)
  44. },
  45. /**
  46. * 生命周期函数--监听页面加载
  47. */
  48. onLoad(options) {
  49. wx.setStorageSync('name', "笑笑")
  50. setTimeout(()=>{
  51. // 原生小程序中
  52. // this.setData({})
  53. // obj.age = 29;
  54. this.setData({
  55. obj:{
  56. name:"小郑",
  57. age: 29
  58. }
  59. })
  60. wx.showToast({
  61. title: '更新成功',
  62. })
  63. },4000)
  64. },
  65. /**
  66. * 生命周期函数--监听页面初次渲染完成
  67. */
  68. onReady() {
  69. },
  70. /**
  71. * 生命周期函数--监听页面显示
  72. */
  73. onShow() {
  74. },
  75. /**
  76. * 生命周期函数--监听页面隐藏
  77. */
  78. onHide() {
  79. },
  80. /**
  81. * 生命周期函数--监听页面卸载
  82. */
  83. onUnload() {
  84. },
  85. /**
  86. * 页面相关事件处理函数--监听用户下拉动作
  87. */
  88. onPullDownRefresh() {
  89. console.log("开启下拉")
  90. },
  91. /**
  92. * 页面上拉触底事件的处理函数
  93. */
  94. onReachBottom() {
  95. },
  96. /**
  97. * 用户点击右上角分享
  98. */
  99. onShareAppMessage() {
  100. }
  101. })