home.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // pages/home/home.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. arr:[
  8. {
  9. name:"孙悟空",
  10. age: 10
  11. },
  12. {
  13. name:"猪八戒",
  14. age: 20
  15. },
  16. {
  17. name:"沙和尚",
  18. age: 30
  19. }
  20. ],
  21. obj: {
  22. address:"哈尔滨",
  23. temp: 30
  24. },
  25. week:6
  26. },
  27. showMain() {
  28. console.log("你好")
  29. wx.showToast({
  30. title: 'hi',
  31. })
  32. wx.setStorageSync('token', '哈哈哈')
  33. },
  34. showMsg() {
  35. wx.showToast({
  36. title: 'Msg',
  37. })
  38. console.log(wx.getStorageSync('token'))
  39. },
  40. showWord1() {
  41. console.log("红色")
  42. },
  43. showWord2(event) {
  44. console.log("黄色",event)
  45. },
  46. changePart1() {
  47. console.log(1)
  48. },
  49. changePart2() {
  50. console.log(2)
  51. },
  52. changePart3() {
  53. console.log(3)
  54. },
  55. goToList() {
  56. console.log("点击")
  57. // 不能跳转tabbar页面
  58. // wx.navigateTo({
  59. // url: '/pages/detail/detail',
  60. // })
  61. // 只跳转tabbar页面
  62. // wx.switchTab({
  63. // url: '/pages/detail/detail',
  64. // })
  65. // 不能跳转tabbar页面
  66. // wx.redirectTo({
  67. // url: '/pages/detail/detail',
  68. // })
  69. wx.reLaunch({
  70. url: '/pages/detail/detail',
  71. })
  72. },
  73. /**
  74. * 生命周期函数--监听页面加载
  75. */
  76. onLoad(options) {
  77. },
  78. /**
  79. * 生命周期函数--监听页面初次渲染完成
  80. */
  81. onReady() {
  82. },
  83. /**
  84. * 生命周期函数--监听页面显示
  85. */
  86. onShow() {
  87. },
  88. /**
  89. * 生命周期函数--监听页面隐藏
  90. */
  91. onHide() {
  92. },
  93. /**
  94. * 生命周期函数--监听页面卸载
  95. */
  96. onUnload() {
  97. },
  98. /**
  99. * 页面相关事件处理函数--监听用户下拉动作
  100. */
  101. onPullDownRefresh() {
  102. },
  103. /**
  104. * 页面上拉触底事件的处理函数
  105. */
  106. onReachBottom() {
  107. },
  108. /**
  109. * 用户点击右上角分享
  110. */
  111. onShareAppMessage() {
  112. }
  113. })