// common/components/drop-down/index.js
Component({
  /**
   * 组件的属性列表
   */
  options: {
    addGlobalClass: true,
    externalClasses: ['drop-con']
  },
  properties: {
    navItems: {
      type: Object,
      value: false,
      observer(newVal, oldVal, changedPath) {
      }
    },
    exhiNum: {
      type: Number,
      value: 0,
      observer(newVal, oldVal, changedPath) {
      }
    },
    activeType: {
      type: String,
      value: 0,
      observer(newVal, oldVal, changedPath) {
      }
    },
    activeDist: {
      type: String,
      value: 0,
      observer(newVal, oldVal, changedPath) {
      }
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    activeIdx: 1
  },

  /**
   * 组件的方法列表
   */
  methods: {
    closeMask() {
      const myEventDetail = false // detail对象，提供给事件监听函数
      const myEventOption = {} // 触发事件的选项
      this.triggerEvent('closeMask', myEventDetail, myEventOption)
    },
    topItem(e) {
      console.log()
      let type = this.data.navItems.type
      let id = e.currentTarget.dataset.id
      let myEventDetail, myEventOption
      if (type){
        if (type === "dist") {
          myEventDetail = {
            activeType: this.data.activeType,
            activeDist: id
          } // detail对象，提供给事件监听函数
          myEventOption = {} // 触发事件的选项
        }
        else {
          myEventDetail = {
            activeType: id,
            activeDist: this.data.activeDist
          } // detail对象，提供给事件监听函数
          myEventOption = {} // 触发事件的选项
        }

        this.triggerEvent('activeItem', myEventDetail, myEventOption)
      }

    }
  }
})