index.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import hover from '../behaviors/hover';
  2. Component({
  3. behaviors:[hover],
  4. relations: {
  5. '../list/index': {
  6. type: 'parent', // 关联的目标节点应为子节点
  7. linked() {
  8. // 每次有custom-li被插入时执行,target是该节点实例对象,触发在该节点attached生命周期之后
  9. },
  10. linkChanged() {
  11. // 每次有custom-li被移动后执行,target是该节点实例对象,触发在该节点moved生命周期之后
  12. },
  13. unlinked() {
  14. // 每次有custom-li被移除时执行,target是该节点实例对象,触发在该节点detached生命周期之后
  15. }
  16. }
  17. },
  18. options: {
  19. multipleSlots: true
  20. },
  21. externalClasses: [
  22. 'l-class',
  23. 'l-class-icon',
  24. 'l-icon-class',
  25. 'l-class-image',
  26. 'l-image-class',
  27. 'l-class-right',
  28. 'l-right-class',
  29. 'l-class-content',
  30. 'l-content-class',
  31. 'l-class-desc',
  32. 'l-desc-class'
  33. ],
  34. properties: {
  35. icon: String,
  36. iconColor: {
  37. type: String,
  38. value: '#3963BC'
  39. },
  40. iconSize: {
  41. type: String,
  42. value: '28'
  43. },
  44. image: String,
  45. title: String,
  46. desc: String,
  47. tagPosition: {
  48. type: String,
  49. value: 'left'
  50. },
  51. tagContent: String,
  52. tagShape: {
  53. type: String,
  54. value: 'square'
  55. },
  56. tagColor: String,
  57. tagPlain: Boolean,
  58. badgePosition: {
  59. type: String,
  60. value: 'left'
  61. },
  62. dotBadge: Boolean,
  63. badgeCount: Number,
  64. badgeMaxCount: {
  65. type: Number,
  66. value: 99
  67. },
  68. badgeCountType: {
  69. type: String,
  70. value: 'overflow'
  71. },
  72. rightDesc: String,
  73. gap: Number,
  74. leftGap: Number,
  75. rightGap: Number,
  76. isLink: {
  77. type: Boolean,
  78. value: true,
  79. },
  80. linkType: {
  81. type: String,
  82. value: 'navigateTo'
  83. },
  84. url: String
  85. },
  86. methods: {
  87. tapcell: function (e) {
  88. const {
  89. linkType,
  90. url
  91. } = e.currentTarget.dataset;
  92. if (url) {
  93. wx[linkType]({
  94. url
  95. });
  96. }
  97. this.triggerEvent('lintap', {
  98. e
  99. }, { bubbles: true, composed: true });
  100. }
  101. }
  102. });