index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import {
  2. storeBindingsBehavior
  3. } from 'mobx-miniprogram-bindings'
  4. import {
  5. store
  6. } from '~/store/index'
  7. Component({
  8. behaviors: [storeBindingsBehavior],
  9. storeBindings: {
  10. store,
  11. fields: {
  12. userInfo: 'userInfo'
  13. },
  14. },
  15. /**
  16. * 组件的属性列表
  17. */
  18. properties: {
  19. },
  20. /**
  21. * 组件的初始数据
  22. */
  23. data: {
  24. selected: 0,
  25. color: "#999999",
  26. selectedColor: "#32CA69",
  27. listTab: [{
  28. "pagePath": "/pages/index/index",
  29. "text": "推荐",
  30. "iconPath": "/static/tj.png",
  31. "selectedIconPath": "/static/tj2.png"
  32. }, {
  33. "pagePath": "/pages/activity/index",
  34. "text": "活动",
  35. "iconPath": "/static/activity.png",
  36. "selectedIconPath": "/static/activity2.png"
  37. }, {
  38. "pagePath": "/pages/works/index",
  39. "text": "作品",
  40. "iconPath": "/static/zp.png",
  41. "selectedIconPath": "/static/zp2.png"
  42. }, {
  43. "pagePath": "/pages/my/index",
  44. "text": "我的",
  45. "iconPath": "/static/my.png",
  46. "selectedIconPath": "/static/my2.png"
  47. }]
  48. },
  49. /**
  50. * 组件的方法列表
  51. */
  52. methods: {
  53. switchTab(e) {
  54. const data = e.currentTarget.dataset;
  55. const url = data.path;
  56. wx.switchTab({
  57. url
  58. });
  59. }
  60. }
  61. })