// components/searchSelectWrapper/index.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    label: String,
    placeholder: String,
    text: String,
    fieldType: {
      type: String,
      value: "text"
    },
    type: {
      type: String,
      value: "select"
    },
    useSlot: Boolean,
    hideBorder: Boolean,
    required: Boolean,
    transparent: Boolean,
    allowClear: Boolean,
    hideMargin: Boolean,
  },

  /**
   * 组件的初始数据
   */
  data: {
    keyword: "",
    text: "",
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onSearch() {
      this.triggerEvent("search")
    },
    onChangeKeyword(e) {
      this.setData({ keyword: e.detail });
    },
    onChangeText(e) {
      this.setData({ text: e.detail });
      this.triggerEvent("changeText", e.detail)
    },
    onSearchKeyword() {
      this.triggerEvent("searchKeyword", this.data.keyword)
      this.setData({ keyword: "" })
    },
    onClear() {
      this.triggerEvent("clear")
    }
  }
})