index.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // common/components/drop-down/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. options: {
  7. addGlobalClass: true,
  8. externalClasses: ['drop-con']
  9. },
  10. properties: {
  11. navItems: {
  12. type: Object,
  13. value: false,
  14. observer(newVal, oldVal, changedPath) {
  15. }
  16. },
  17. exhiNum: {
  18. type: Number,
  19. value: 0,
  20. observer(newVal, oldVal, changedPath) {
  21. }
  22. },
  23. activeType: {
  24. type: String,
  25. value: 0,
  26. observer(newVal, oldVal, changedPath) {
  27. }
  28. },
  29. activeDist: {
  30. type: String,
  31. value: 0,
  32. observer(newVal, oldVal, changedPath) {
  33. }
  34. }
  35. },
  36. /**
  37. * 组件的初始数据
  38. */
  39. data: {
  40. activeIdx: 1
  41. },
  42. /**
  43. * 组件的方法列表
  44. */
  45. methods: {
  46. closeMask() {
  47. const myEventDetail = false // detail对象,提供给事件监听函数
  48. const myEventOption = {} // 触发事件的选项
  49. this.triggerEvent('closeMask', myEventDetail, myEventOption)
  50. },
  51. topItem(e) {
  52. console.log()
  53. let type = this.data.navItems.type
  54. let id = e.currentTarget.dataset.id
  55. let myEventDetail, myEventOption
  56. if (type === "dist") {
  57. myEventDetail = {
  58. activeType: this.data.activeType,
  59. activeDist: id
  60. } // detail对象,提供给事件监听函数
  61. myEventOption = {} // 触发事件的选项
  62. }
  63. else {
  64. myEventDetail = {
  65. activeType: id,
  66. activeDist: this.data.activeDist
  67. } // detail对象,提供给事件监听函数
  68. myEventOption = {} // 触发事件的选项
  69. }
  70. this.triggerEvent('activeItem', myEventDetail, myEventOption)
  71. }
  72. }
  73. })