Coder Social home page Coder Social logo

huangciyin / react-weui-form Goto Github PK

View Code? Open in Web Editor NEW

This project forked from n7best/react-weui-form

0.0 2.0 0.0 118 KB

react-weui fast form creation with validation

Home Page: http://n7best.github.io/react-weui-form/

JavaScript 95.84% CSS 2.83% HTML 1.33%

react-weui-form's Introduction

react-weui-form

weui-react快速表单创建

手机预览

使用

npm安装

npm install react-weui-form

react倒入

import WeForm from 'react-weui-form'

定义表单

//定义架构
let schema = [
  //一个新的列表组
  {
    label:'基本资料',
    properties:[
    //表单单位定义
    //创建一个文本输入,验证为2到15为字符
      {
        id:'username',
        label:'用户名',
        default:'',
        type:'text',
        placeholder:'2到15位字符',
        rule:'required|between:2,15|string'
      },
      {
        id:'password',
        label:'密码',
        type:'password',
        placeholder:'输入您的密码',
        rule:'required'
      }
    ]
  }
];
//定义设置
let form = {
  //定义按钮
  actions:[
    {
      label:'登陆',
      type:'primary',
      onClick :(data)=>alert(JSON.stringify(data,null,2)),
    }
  ]
};

输出React组件

<WeForm schema={schema} form={form}/>

#可用type text,password,number,date,datetime,textarea,select,checkbox #可用验证rule 用法

rule:'required|between:2,15'
类别 属性
required
string
number
date mindate[optional],maxdate[optional]
datetime mindate[optional],maxdate[optional]
between min[optional],max[optional]

react-weui-form's People

Contributors

n7best avatar

Watchers

James Cloos avatar  avatar

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.