We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
反馈问题请先查看文档和务必提供详细的复现代码,遵循如下格式,描述不清楚的问题将会直接关闭。
vue2+tdesign
在基于vue2-form-core给tdesign做适配时,tdesign中formItem自定义校验规则validator的形式为 type CustomValidator = (val: ValueType) => CustomValidateResolveType | Promise<CustomValidateResolveType> , 只传递表单值value,并且返回一个对象表示结果而不是使用callback进行回调。 在vue2-form-core中formItem的rules中validator必须依赖于callback,导致适配tdesign时callback为空 调用失败
type CustomValidator = (val: ValueType) => CustomValidateResolveType | Promise<CustomValidateResolveType>
当前解决方式是在tdesign的formItem定义时,传入自定义callback函数
validator(rule, value) { return validateRule.validator(rule,value,callback); },
同时在vue2-form-core打补丁(patch-package), 在formItem虚拟节点创建时,为value赋值 value = self.value,避免value被覆盖获取不到表单值的情况。
value = self.value
扩展vue2-form-core中formItem节点兼容性,支持自定义callback函数; (仅为抛砖引玉,看大佬有什么更好的办法)
The text was updated successfully, but these errors were encountered:
是的,底层core 都是默认按了element vue2的版本格式来的。
这里只需要你在适配 formItem 组件的时候做对应的转换即可 callBack 转为 promise 到tdesign 的formitem
Sorry, something went wrong.
看了下 之前vue3的版本 在core里面直接做了兼容,这里也可以vue2 core 补上相似逻辑。
当然你也可以直接贡献 😁
feat(lib): vue2版本 formItem 默认支持promise 形式
6e48d27
re #316
最新版已支持 直接使用promise
No branches or pull requests
反馈问题请先查看文档和务必提供详细的复现代码,遵循如下格式,描述不清楚的问题将会直接关闭。
vue和ui框架
vue2+tdesign
问题描述
在基于vue2-form-core给tdesign做适配时,tdesign中formItem自定义校验规则validator的形式为
type CustomValidator = (val: ValueType) => CustomValidateResolveType | Promise<CustomValidateResolveType>
,只传递表单值value,并且返回一个对象表示结果而不是使用callback进行回调。
在vue2-form-core中formItem的rules中validator必须依赖于callback,导致适配tdesign时callback为空 调用失败
如何复现
当前解决方式是在tdesign的formItem定义时,传入自定义callback函数
同时在vue2-form-core打补丁(patch-package), 在formItem虚拟节点创建时,为value赋值
value = self.value
,避免value被覆盖获取不到表单值的情况。期望的结果
扩展vue2-form-core中formItem节点兼容性,支持自定义callback函数;
(仅为抛砖引玉,看大佬有什么更好的办法)
The text was updated successfully, but these errors were encountered: