
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
daform 是一个高效开发表单的 one for all 方案。
文档开发中...
npm install daform
确保 React 版本为 ^16.6.3, 关于 React 16 特性可参考 React 特性剪辑(版本 16.0 ~ 16.9)
import React from 'react'
import { Input } from 'antd'
import { Form, FormItem } from 'daForm'
@Form()
class Demo1 extends React.Component {
render() {
return (
<>
<FormItem name="name" label="姓名"><Input /></FormItem>
<FormItem name="age" label="年龄"><Input /></FormItem>
</>
)
}
}
daForm 内置了动态表单组件 <Dynamic>
, 使用其可以快速完成增删配置需求。
import React from 'react'
import { Input } from 'antd'
import { Form, FormItem } from 'daForm'
@Form()
class Demo1 extends React.Component {
render() {
return (
<Dynamic>
<FormItem name="name" label="姓名"><Input /></FormItem>
<FormItem name="age" label="年龄"><Input /></FormItem>
</Dynamic>
)
}
}
经过 Form
装饰的组件后具有 form
和 errorFields
对象。
form
提供的 api 见如下表格:属性/方法 | 意义 |
---|---|
formData | 当前所有表单字段的数据映射 |
getFormItem(itemName) | 获取某一个表单字段的值 |
errorFields
包含当前表单的报错消息, 其等同于 async-validator 中的 fields 属性。FormItem
接受的属性见如下表格:
属性 | 意义 | 必填 | 默认 |
---|---|---|---|
name | 表单传输的名字 | yes | |
label | 表单的名字 | no | '' |
colon | 是否带分号 | no | true |
inline | 是否内联 | no | false |
labelCol | 表单的名字占位 | no | 8 |
wrapCol | 表单占位 | no | 16 |
disable | 是否禁用 | no | false |
initialValue | 初始(默认)值 | no |
Dynamic
接受的属性见如下表格:
属性 | 意义 | 必填 | 默认 |
---|---|---|---|
initialValue | 动态表单的初始值(数组) | no |
npm test
FAQs
daform 是一个高效开发表单的 one for all 方案。
We found that daform demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.