index.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Component({
  2. properties: {
  3. list: {
  4. type: Array
  5. },
  6. showAll: { //是否显示全部(包含值为空项)
  7. type: Boolean,
  8. value: true
  9. },
  10. clickItem: {
  11. type: Function
  12. }
  13. },
  14. lifetimes: {
  15. attached() {
  16. getApp().globalData.Language.getLanguagePackage(this)
  17. }
  18. },
  19. options: {
  20. multipleSlots: true
  21. },
  22. methods: {
  23. /* 单击项目 */
  24. clickItem(e) {
  25. const {
  26. item
  27. } = e.currentTarget.dataset;
  28. this.triggerEvent("clickItem", item)
  29. getApp().globalData.previewClick && getApp().globalData.previewClick(item)
  30. },
  31. /* 单击补充区域 */
  32. clickRep(e) {
  33. const {
  34. item
  35. } = e.currentTarget.dataset;
  36. this.triggerEvent("clickItem", item)
  37. getApp().globalData.previewClick && getApp().globalData.previewClick(item)
  38. }
  39. }
  40. })