Closed insistence closed 3 months ago
已修复
感谢大佬的快速回复,但是貌似还是有问题,麻烦看看这个例子test,在schema的rules中设置了validateTrigger,但并没有按照预想效果触发
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} />;
};
1.依赖仓库的版本(Dependencies versions):
2.问题描述(Bug description):
3.出现问题的 schema demo(Reproduction schema demo):
4.最小复现 demo(Reproduction demo):
form-render demo https://codesandbox.io/p/sandbox/cool-waterfall-d3zm3j