ant-design-vue a-select 获取选中行的所有数据
<template><a-selectv-model:value="selectValue"show-searchplaceholder="input search text"style="width: 200px":default-active-first-option="false":show-arrow="false":filter-option="false":not-f
·
<template>
<a-select
v-model:value="selectValue"
show-search
placeholder="input search text"
style="width: 200px"
:default-active-first-option="false"
:show-arrow="false"
:filter-option="false"
:not-found-content="null"
:options="data"
@search="handleSearch"
@change="handleChange"
>
</a-select>
</template>
<script>
import { defineComponent } from 'vue';
export default defineComponent({
setup() {
let selectValue = '';
let data = [
{
code:'1',
value:'cgb',
},
{
code:'2',
value:'lcf',
},
];
const handleSearch = val => {
console.log('handleSearch val',val);
};
const handleChange = (val,option) =>{
console.log('handleChange val',val);
console.log('handleChange option',option);//option为选中行的所有数据,如:{code: "1", value: "cgb"}
};
return {
handleSearch,
handleChange,
data,
selectValue,
};
},
});
</script>
更多推荐
已为社区贡献2条内容
所有评论(0)