index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. Component({
  2. externalClasses: ['i-class'],
  3. relations: {
  4. '../tab-bar/index': {
  5. type: 'parent'
  6. }
  7. },
  8. properties: {
  9. icon: {
  10. type: String,
  11. value: ''
  12. },
  13. currentIcon: {
  14. type: String,
  15. value: ''
  16. },
  17. img: {
  18. type: String,
  19. value: ''
  20. },
  21. currentImg: {
  22. type: String,
  23. value: ''
  24. },
  25. key: {
  26. type: String,
  27. value: ''
  28. },
  29. title: {
  30. type: String,
  31. value: ''
  32. },
  33. dot: {
  34. type: Boolean,
  35. value: false
  36. },
  37. count: {
  38. type: Number,
  39. value: 0
  40. }
  41. },
  42. data: {
  43. current: false,
  44. currentColor: ''
  45. },
  46. methods: {
  47. changeCurrent (current) {
  48. this.setData({ current });
  49. },
  50. changeCurrentColor (currentColor) {
  51. this.setData({ currentColor });
  52. },
  53. handleClickItem () {
  54. const parent = this.getRelationNodes('../tab-bar/index')[0];
  55. parent.emitEvent(this.data.key);
  56. }
  57. }
  58. });