<template>
  <v-combobox
    :model-value="search"
    :items="searchHistory"
    prepend-inner-icon="mdi-magnify"
    placeholder="搜索名称/域名…"
    variant="outlined"
    density="compact"
    hide-details
    clearable
    :auto-select-first="false"
    @update:model-value="$emit('update:search', $event)"
    @keydown.enter.prevent="$emit('search-commit')"
  />
</template>

<script setup lang="ts">
defineProps<{
  search: string
  searchHistory: string[]
}>()

defineEmits<{
  'update:search': [value: string | null]
  'search-commit': []
}>()
</script>
