Git Product home page Git Product logo

Comments (4)

github-actions avatar github-actions commented on June 1, 2024

以下的 Issues 可能会帮助到你 / The following issues may help you

  • [#8006][🐛[BUG]Table.EXPAND_COLUMN not working][60%]

from pro-components.

SANmq avatar SANmq commented on June 1, 2024

validateTrigger 为 onBlur没生效的原因找到了。因为源码中有一个WithValueFomFiledProps组件分隔了form.item和表单组件间的props传递。其中有一个判断
const isProFormComponent = // @ts-ignore filedChildren?.type?.displayName !== 'ProFormComponent';
如果为false的话会导致很多props不会透传给antd的form.item。这个干嘛用的不太清楚。
所以解决方案可以是给自己自定义的组件加上 displayName ="ProFormComponent" 属性就能解决。
不过这个应该不是最终解决方案,还是得看它原来是要干嘛
@chenshuai2144

from pro-components.

SANmq avatar SANmq commented on June 1, 2024

重新看了一下就是onBlur没有传进去,跟isProFormComponent无关。
const { children: filedChildren, onChange, onBlur, ignoreFormItem, valuePropName = 'value', ...restProps } = formFieldProps;
omitUndefined({ ...restProps, [valuePropName]: formFieldProps[valuePropName], ...filedChildren.props, onChange: finalChange, fieldProps, })

就是restProps中没有onBlur了,所以没有透传给proformItem下的组件

from pro-components.

taajason avatar taajason commented on June 1, 2024

在使用 2.7 版本的时候,发现是可以的
当在rules中设置时,无法触发校验,如下:
<ProFormText rules={[ { required: true, validator: validatorFunc, validateTrigger: "onBlur" }, ]} />
当validateTrigger属性放在ProFormText中时,触发可以生效
<ProFormText validateTrigger="onBlur" rules={[ { required: true, validator: validatorFunc }, ]} />
官方文档中也是如此设置,希望有帮助!

from pro-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.