【发布时间】:2021-11-28 10:38:00
【问题描述】:
我使用 asyncFetch 并从 SelectWiget 中选择值,在外部进行任何点击后,将此选择设为空值。
我对字段使用下一个配置
products: {
type: '!struct',
label: 'Products',
subfields: {
title: {
type: 'select',
label: 'Name',
fieldSettings: {
asyncFetch: async (search, offset) => {
const toSearch = _.isEmpty(search) ? 'null' : search;
const prodApi = (await axios.get(`http://localhost:8002/api/products/1/${toSearch}?offset=${offset}`, { headers: authHeader() }));
const productsValues = prodApi.data.data.map(
product => ({
title: product.title,
value: product.id
})
)
return {
values: productsValues,
hasMore: true,
}
},
useAsyncSearch: true,
useLoadMore: true,
forceAsyncSearch: false,
allowCustomValues: false
}
},
另一个错误是当我选择某个值时再次调用 asyncFetch。
这是该软件包中的错误还是我缺少某些配置?
我使用的包是 react-awesome-query-builder
【问题讨论】:
标签: reactjs query-builder