sxfad / react-admin

基于 Ant Design React 的管理系统架构
https://sxfad.github.io/react-admin
609 stars 170 forks source link

建议form-item组件加个pattern字段 #111

Closed senjyouhara closed 2 years ago

senjyouhara commented 2 years ago

建议form-item组件加个pattern字段,毕竟大多数效验基本上都可以一个正则搞定的,加这个字段就避免了经常性书写rules字段

senjyouhara commented 2 years ago

还有个问题 在table-editable里的EditableCell方法

    if (eleProps) {
        childNode = (
            <FormItem
                label={title}
                showLabel={false}
                colon={false}
                name={dataIndex}
                {...eleProps}
            />
        );
    }

这里showLabel 我看了formItem里是没这个字段相关的代码 是否还未实现 并且这个字段会抛出一个错误

React does not recognize the `showLabel` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom   
 attribute, spell it as lowercase `showlabel` instead. If you accidentally passed it from a parent component, remove it from the
 DOM element.
zkboys commented 2 years ago

showLabel 属性没有了,忘记删除了。

zkboys commented 2 years ago

FormItem 的 pattern 已添加,将@ra-lib/admin 升级到 0.1.2版本即可。 使用方法: pattern={[/^1\d{10}$/, '请输入正确的账号']}

senjyouhara commented 2 years ago

可以了 感谢更新