drop.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // pages/drop/drop.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. winWidth: 0,
  8. winHeight: 0,
  9. currentTab: 0,
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. var that = this;
  16. /**
  17. * 获取当前设备的宽高
  18. */
  19. wx.getSystemInfo( {
  20. success: function( res ) {
  21. that.setData( {
  22. winWidth: res.windowWidth,
  23. winHeight: res.windowHeight
  24. });
  25. }
  26. });
  27. },
  28. /**
  29. * 生命周期函数--监听页面初次渲染完成
  30. */
  31. onReady: function () {
  32. },
  33. /**
  34. * 生命周期函数--监听页面显示
  35. */
  36. onShow: function () {
  37. },
  38. /**
  39. * 生命周期函数--监听页面隐藏
  40. */
  41. onHide: function () {
  42. },
  43. /**
  44. * 生命周期函数--监听页面卸载
  45. */
  46. onUnload: function () {
  47. },
  48. /**
  49. * 页面相关事件处理函数--监听用户下拉动作
  50. */
  51. onPullDownRefresh: function () {
  52. },
  53. /**
  54. * 页面上拉触底事件的处理函数
  55. */
  56. onReachBottom: function () {
  57. },
  58. /**
  59. * 用户点击右上角分享
  60. */
  61. onShareAppMessage: function () {
  62. },
  63. swichNav: function( e ) {
  64. var that = this;
  65. if( this.data.currentTab === e.target.dataset.current ) {
  66. return false;
  67. } else {
  68. that.setData( {
  69. currentTab: e.target.dataset.current
  70. })
  71. }
  72. },
  73. bindChange: function( e ) {
  74. var that = this;
  75. that.setData( { currentTab: e.detail.current });
  76. },
  77. })