ant design vue 关于select 请求数据后没有立即显示的问题

设置:filterOption 属性为false

vben admin框架中封装了ant design vue select组件在使用提供的updaeSchema函数时只能更新一次,有知道解决的老铁可以告诉我.代码如下:

{
field: 'package',
label: '套餐项目',
component: 'ApiSelect',
componentProps: ({ formActionType })=>{
const fetchData = ref<OptionsItem[]>([]);
const fetchTest = debounce(values=>{
console.log('test:', values);
const httpData = {
c_id: 1,
param: values
};
getchildrenTest(httpData).then(res => {
console.log('res:', res);
const item = res.map(test=> {
return {
label: `${test.name}`,
value: test.id,
}});
fetchData.value = item;
})
},1000);
watch(()=>fetchData.value,()=>{
console.log('fetchData):',fetchData.value);
formActionType.updateSchema([{
field:'package',
componentProps:{
options:fetchData.value,
showSearch: true,
filterOption:false,
mode: 'multiple',
},
}]);
})
return{
// api: getchildrenTest,
labelField: 'name',
valueField: 'id',
showSearch: true,
mode: 'multiple',
onSearch: fetchTest,
// params:{c_id: 1},
filterOption: false,
// filterOption: (input,options)=>{
// return options?.label.toLowerCase().indexOf(input.toLowerCase()) >=0;
// },
}
},
colProps: { span: 24 },
},


来自为知笔记(Wiz)


posted on   白衣风云  阅读(42)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
历史上的今天:
2020-08-11 spring依赖注入的三种方式
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示