<!-- 选择下拉框 -->
<template>
  <a-select
    show-search
    optionFilterProp="label"
    :options="data"
    allow-clear
    :value="value"
    :placeholder="placeholder"
    @update:value="updateValue"
    @blur="onBlur"
  />
</template>

<script lang="ts" setup>
  import { getDictionaryOptions } from '@/utils/common';
  import { ref } from "vue";
  import { SelectProps } from "ant-design-vue";

  const emit = defineEmits<{
    (e: 'update:value', value: string): void;
    (e: 'blur'): void;
  }>();

  withDefaults(
    defineProps<{
      value?: string;
      placeholder?: string;
    }>(),
    {
      placeholder: '请选择运费模板'
    }
  );

  // 字典数据
  const data = ref<SelectProps['options']>([
    {
      label: '全国包邮(除偏远地区)',
      text: '全国包邮(除偏远地区)',
      value: 0
    }
  ]);

  /* 更新选中数据 */
  const updateValue = (value: string) => {
    emit('update:value', value);
  };

  /* 失去焦点 */
  const onBlur = () => {
    emit('blur');
  };
</script>
