Skip to content
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

Bug: Cascader 异步加载 使用 ApiComponent 数据绑定失败 #5519

Open
5 tasks done
yangliadmin opened this issue Feb 12, 2025 · 3 comments
Open
5 tasks done

Bug: Cascader 异步加载 使用 ApiComponent 数据绑定失败 #5519

yangliadmin opened this issue Feb 12, 2025 · 3 comments

Comments

@yangliadmin
Copy link

Version

Vben Admin V5

Describe the bug?

Image

Image

Reproduction

Naive ui 的Cascader 异步加载子级追加上去后无法显示,经过我的测试 发现 [props.optionsPropName]: unref(refOptions), 就没问题

System Info

最新版

Relevant log output

Validations

@mynetfan
Copy link
Collaborator

ApiComponent的属性value-field、label-field、children-field与Naive ui 的Cascader冲突了

@mynetfan
Copy link
Collaborator

不修改ApiComponent的情况下,可以通过afterFetch转换数据到默认的字段(label、value、children),这样也能解决问题

@yangliadmin
Copy link
Author

yangliadmin commented Feb 13, 2025

目前返回的就是label和value字段,children是 api 请求加载的。
我猜测应该是异步加载children绑到原数据上了,组件上绑的的数据是重新转换过的,导致无法显示。
其实我觉得没必要做map转换,现在大部分选择组件都支持自定义 label,value和children。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants