alibaba / x-render

🚴‍♀️ 阿里 - 很易用的中后台「表单 / 表格 / 图表」解决方案
https://xrender.fun
6.91k stars 980 forks source link

不支持AllowClear触发Form的onChange更新 #1532

Closed hulk4fe closed 2 days ago

hulk4fe commented 3 weeks ago

{ type: 'object', displayType: 'column', properties: { metadataKey: { title: ‘标题’, type: 'string', props: { placeholder: '请输入内容搜索', allowClear: true, onClear: () => {} onChange: () => {} ....

return

这里如果要实现表单搜索时单项支持清空时,给props加了allowClear后,点击清空onFormChange无法监听到值的清空变化,如果改为在props里面onChange监听,是可以的,但是在onFormChange中拿到的values是空,且form.getFeildsValue拿到的也是空,而且你们官方文档也不建议使用组件的onChange事件,此时我又想到antd@4.6后支持onClear事件,但是onClear事件根本不触发(这里不确定是xrender覆盖行为还是其他。。。)

lhbxs commented 2 days ago

直接用这个组件?https://xrender.fun/form-render/disaply-search

lhbxs commented 2 days ago

或者通过全局的 watch 监听