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[] | - | - |