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

form-render在rules中设置validateTrigger依然不生效 #1507

Open
insistence opened this issue Mar 26, 2024 · 0 comments
Open

form-render在rules中设置validateTrigger依然不生效 #1507

insistence opened this issue Mar 26, 2024 · 0 comments
Assignees

Comments

@insistence
Copy link

1.依赖仓库的版本(Dependencies versions)

  • react:^18.0.0
  • form-render:2.4.3
  • table-render:
  • antd:5.15.3

2.问题描述(Bug description)

3.出现问题的 schema demo(Reproduction schema demo)

import React from "react";
import FormRender, { useForm } from "form-render";

const schema = {
  type: "object",
  displayType: "row",
  properties: {
    input1: {
      title: "必填",
      type: "string",
      rules: [
        {
          required: true,
          message: "rules-onBlur提示",
          validateTrigger: "onBlur",
        },
      ],
    },
    input2: {
      title: "数字最大值",
      type: "number",
      max: 2,
      rules: [
        {
          required: true,
          message: "rules-onFocus提示",
          validateTrigger: "onFocus",
        },
      ],
    },
    input3: {
      title: "数字最小值",
      type: "number",
      min: 10,
      required: true,
    },
    input4: {
      title: "字符最大长度",
      type: "string",
      max: 2,
      required: true,
    },
    input5: {
      title: "字符最小长度",
      type: "string",
      min: 10,
      required: true,
    },
    input6: {
      title: "url 校验",
      type: "string",
      required: true,
      format: "url",
    },
    input7: {
      title: "email 校验",
      type: "string",
      required: true,
      format: "email",
    },
    input8: {
      title: "图片格式校验",
      type: "string",
      required: true,
      format: "image",
    },
  },
};

export default () => {
  const form = useForm();

  return <FormRender schema={schema} form={form} footer={true} />;
};

4.最小复现 demo(Reproduction demo)

form-render demo https://codesandbox.io/p/sandbox/cool-waterfall-d3zm3j

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

No branches or pull requests

2 participants