foot.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // commpents/mobile-frame/mobile-main.js
  2. const app = getApp()
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. options: { multipleSlots: true },
  8. properties: {
  9. tabSelectid: { type: 'string', value: '' }
  10. },
  11. // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
  12. attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
  13. ready: function () { },
  14. pageLifetimes: {
  15. // 组件所在页面的生命周期函数
  16. show: function () { this.search() },
  17. hide: function () { },
  18. resize: function () { },
  19. },
  20. /**
  21. * 组件的初始数据
  22. */
  23. data: {
  24. active: '0'
  25. },
  26. /**
  27. * 组件的方法列表
  28. */
  29. methods: {
  30. // 返回上一级
  31. tabPath(e) {
  32. this.triggerEvent('tabPath', { index: e.detail })
  33. },
  34. search() {
  35. let pages = getCurrentPages();
  36. let currentPage = pages[pages.length - 1];
  37. if (currentPage.route == 'pages/market/index') {
  38. this.setData({ active: 0 })
  39. } else {
  40. this.setData({ active: 1 })
  41. }
  42. }
  43. }
  44. })