rise.js 779 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. var app = getApp()
  2. Page({
  3. data: {
  4. // 页面配置
  5. winWidth: 0,
  6. winHeight: 0,
  7. // tab切换
  8. currentTab: 0,
  9. },
  10. onLoad: function() {
  11. var that = this;
  12. // 获取系统信息
  13. wx.getSystemInfo({
  14. success: function(res) {
  15. that.setData({
  16. winWidth: res.windowWidth,
  17. winHeight: res.windowHeight
  18. });
  19. }
  20. });
  21. },
  22. // 滑动切换tab
  23. bindChange: function(e) {
  24. var that = this;
  25. that.setData({
  26. currentTab: e.detail.current
  27. });
  28. },
  29. // 点击tab切换
  30. swichNav: function(e) {
  31. var that = this;
  32. if (this.data.currentTab === e.target.dataset.current) {
  33. return false;
  34. } else {
  35. that.setData({
  36. currentTab: e.target.dataset.current
  37. })
  38. }
  39. }
  40. })