Giter VIP home page Giter VIP logo

Comments (4)

lhbxs avatar lhbxs commented on May 25, 2024

#1503

from x-render.

lhbxs avatar lhbxs commented on May 25, 2024

已修复

from x-render.

insistence avatar insistence commented on May 25, 2024

感谢大佬的快速回复,但是貌似还是有问题,麻烦看看这个例子test,在schema的rules中设置了validateTrigger,但并没有按照预想效果触发

from x-render.

insistence avatar insistence commented on May 25, 2024
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} />;
};

from x-render.

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.