<template>
  <div>
    <Dropdown trigger="click" style="width:100%;" placement="bottom" @on-click="_dropDown">
      <Input
        v-model="value"
        :placeholder="placeholder"
        icon="ios-search"
        style="width:100%"
        @on-change="_query"
      />
      <DropdownMenu slot="list" style="max-height: 200px;overflow: auto">
        <DropdownItem v-for="item in downData" :key="item" :name="item">
          {{ item.name }}
        </DropdownItem>
      </DropdownMenu>
    </Dropdown>
  </div>
</template>

<script>
export default {
  props: {
    name: null,
    value: null,
    placeholder: null,
    downData: null,
    list: null
  },
  data() {
    return {}
  },
  mounted() {},
  methods: {
    // 选择
    _dropDown(data) {
      this.$emit('on-result-change', 'select', data)
      this.value = data.name
    },
    // 查询
    _query() {
      this.$emit('on-result-change', 'query', this.value)
    }
  }
}
</script>
