npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@freemen/antd-form

v1.0.4

Published

> antd3 form 表单 antd4写法

Downloads

8

Readme

@freemen/antd-form

antd3 form表单改造

参数

  • onFinish 保存数据 函数
  • initialValue 表单初始值
  • 其他参数参照 [https://3x.ant.design/components/form-cn/#Form]

案例

/*
 * @Description: antd3 form表单改造
 * @FilePath: /antd3/src/Form/App.js
 */
import React, { useRef, useEffect } from "react"
import { Input, Icon, Button } from "antd"

import Form from "./index"

const ComInput = React.forwardRef((props, ref) => {
  // console.log("ComInput", props)
  return <Input {...props} />
})



const App = () => {
  let formRef = useRef()
  const onValuesChange = (value, allValues) => {
    // console.log("onValuesChange", value, allValues)
  }
  const onFinish = (value) => {
    console.log("onFinsh", value)
  }
  const onFieldsChange = (fields, allFields) => {
    // console.log("onFieldsChange", fields, allFields)
  }
  useEffect(() => {
    // console.log(formRef)
  }, [])
  return <Form
    ref={formRef}
    onFinish={onFinish}
    onFieldsChange={onFieldsChange}
    onValuesChange={onValuesChange}
    initialValue={{
      username: "张三",
      name1: "1",
      name12: 1,
      password: "12132132"
    }}
  >
    <Form.Item
      name="username"
      rules={[{ required: true, message: 'Please input your username!' }]}
    >
      <Input
        prefix={<Icon
          type="user"
          style={{ color: 'rgba(0,0,0,.25)' }}
        />}
        placeholder="Username" />
    </Form.Item>
    <Form.Item
      name="password"
      rules={[{ required: true, message: 'Please input your Password!' }]}
    >
      <Input
        prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />}
        type="password"
        placeholder="Password"
      />
    </Form.Item>
    <Form.Item name="name1">
      {(...vale) => {
        // console.log(vale)
        return <ComInput />
      }}
    </Form.Item>
    <Form.Item name="name12">
      {((...vale) => {
        // console.log(vale)
        return <div>1</div>
      })()}
    </Form.Item>
    <Form.Item>
      <Button type="primary" htmlType="submit" >
        Log in
      </Button>
    </Form.Item>
  </Form>
}
export default App