tabBar.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Component({
  2. /**
  3. * 组件的属性列表
  4. */
  5. properties: {
  6. },
  7. /**
  8. * 组件的初始数据
  9. */
  10. data: {
  11. list: [{
  12. "pagePath": "../../pages/home/home",
  13. "iconPath": "/imgs/tabbar/tab_home_normal.png",
  14. "selectedIconPath": "/imgs/tabbar/tab_home_select.png",
  15. "text": "首页"
  16. },
  17. {
  18. "iconPath": "/imgs/tabbar/tab_service_normal.png",
  19. "selectedIconPath": "/imgs/tabbar/tab_service_select.png",
  20. "pagePath": "",
  21. "text": "客服"
  22. },
  23. {
  24. "iconPath": "/imgs/tabbar/tab_my_normal.png",
  25. "selectedIconPath": "/imgs/tabbar/tab_my_select.png",
  26. "pagePath": "../../pages/my/my",
  27. "text": "我的"
  28. }
  29. ],
  30. selected: 0
  31. },
  32. /**
  33. * 组件的方法列表
  34. */
  35. methods: {
  36. tapAction(e) {
  37. let {
  38. id
  39. } = e.currentTarget.dataset
  40. this.triggerEvent('action', {
  41. id: id
  42. });
  43. if (id == 2) {
  44. wx.setNavigationBarTitle({
  45. title: '我的',
  46. success: function (res) {}
  47. })
  48. } else {
  49. wx.setNavigationBarTitle({
  50. title: 'hooli海外留学租房',
  51. success: function (res) {}
  52. })
  53. }
  54. this.setData({
  55. selected: id
  56. });
  57. }
  58. }
  59. })