Select 选择器

选择菜单

Code 代码
<template>
  <agm-select
    v-model="currentOption"
    :options="options"
    placeholder="Placeholder"
    :callback="callback"
  />
</template>

<script lang="ts" setup>
import type { ISelectOption } from './src/useOption'
import AgmSelect from './src/index.vue'
const options: ISelectOption[] = [
  {
    label: 'Label A',
    value: 'A',
  },
  {
    label: 'Label B',
    value: 'B',
  },
  {
    label: 'Label C',
    value: 'C',
  },
]

const currentOption = reactive<ISelectOption>({
  label: '',
  value: '',
})

function callback(val: any) {
  // eslint-disable-next-line no-console
  console.log(val, currentOption)
}
</script>

API

参数说明类型可选值默认值
v-model当前选中项ISelectOption--
options菜单项ISelectOption[]--