New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search组件TreeSelect控件配置optionApi显示“无数据” #342
Comments
发现问题是在Search组件中不会自动调用optionApi得到的结果赋值给componentProps!.data。 |
遇到同样的问题,可以在父组件里操作Search 组件的schema,临时解决下。这里奇怪的地方是,在Form 组件里更改了自己的Schema 数组深层属性,这个做法在vue 里其实是不推荐的。 |
看了下源码,Form在渲染formItem的时候调用了: const getOptions = async (fn: Function, item: FormSchema) => { |
|
对啊。奇怪。 |
我也遇到了同样的问题
const formSchema = reactive<FormSchema[]>([
{
label: 'aaa',
field: 'aaa',
component: 'CheckboxGroup',
optionApi: async () => {
return [
{
label: 'a',
value: 'a'
},
{
label: 'b',
value: 'b'
}
]
}
}
])
<Search :schema="formSchema" /> |
FormSchema[]配置:
[{
field: 'bookTypeId',
label: t('book.bookTypeId'),
component: 'TreeSelect',
componentProps: {
nodeKey: 'id',
props: {
label: 'name'
}
},
optionApi: async () => {
const res = await getTreeListApi({} as IListRequest)
return res.data
}
},...]
Search组件TreeSelect控件配置optionApi显示“无数据”。
但是Form组件同样配置,TreeSelect控件配置optionApi缺可以正常下拉选择数据。
The text was updated successfully, but these errors were encountered: