Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
4bcbf6ba
A
ant-design
项目概览
wanjj_1210
/
ant-design
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
ant-design
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4bcbf6ba
编写于
2月 25, 2016
作者:
A
afc163
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:ant-design/ant-design
上级
3ab72afc
85afd74c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
123 addition
and
132 deletion
+123
-132
components/form/demo/validate-basic.md
components/form/demo/validate-basic.md
+58
-60
components/form/demo/validate-customized.md
components/form/demo/validate-customized.md
+8
-6
components/form/demo/validate-other.md
components/form/demo/validate-other.md
+56
-65
components/steps/demo/icon.md
components/steps/demo/icon.md
+1
-1
未找到文件。
components/form/demo/validate-basic.md
浏览文件 @
4bcbf6ba
...
...
@@ -78,94 +78,92 @@ class BasicDemo extends React.Component {
render
()
{
const
{
getFieldProps
,
getFieldError
,
isFieldValidating
}
=
this
.
props
.
form
;
const
nameProps
=
getFieldProps
(
'
name
'
,
{
rules
:
[
{
required
:
true
,
min
:
5
,
message
:
'
用户名至少为 5 个字符
'
},
{
validator
:
this
.
userExists
},
],
});
const
emailProps
=
getFieldProps
(
'
email
'
,
{
validate
:
[{
rules
:
[
{
required
:
true
},
],
trigger
:
'
onBlur
'
,
},
{
rules
:
[
{
type
:
'
email
'
,
message
:
'
请输入正确的邮箱地址
'
},
],
trigger
:
[
'
onBlur
'
,
'
onChange
'
],
}]
});
const
passwdProps
=
getFieldProps
(
'
passwd
'
,
{
rules
:
[
{
required
:
true
,
whitespace
:
true
,
message
:
'
请填写密码
'
},
{
validator
:
this
.
checkPass
.
bind
(
this
)
},
],
});
const
rePasswdProps
=
getFieldProps
(
'
rePasswd
'
,
{
rules
:
[{
required
:
true
,
whitespace
:
true
,
message
:
'
请再次输入密码
'
,
},
{
validator
:
this
.
checkPass2
.
bind
(
this
),
}],
});
const
textareaProps
=
getFieldProps
(
'
textarea
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
真的不打算写点什么吗?
'
},
],
});
const
formItemLayout
=
{
labelCol
:
{
span
:
7
},
wrapperCol
:
{
span
:
12
},
};
return
(
<
Form
horizontal
form
=
{
this
.
props
.
form
}
>
<
FormItem
{
...
formItemLayout
}
label
=
"用户名:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
hasFeedback
help
=
{
isFieldValidating
(
'
name
'
)
?
'
校验中...
'
:
(
getFieldError
(
'
name
'
)
||
[]).
join
(
'
,
'
)
}
>
<
Input
placeholder
=
"实时校验,输入 JasonWood 看看"
{
...
getFieldProps
(
'
name
'
,
{
rules
:
[
{
required
:
true
,
min
:
5
,
message
:
'
用户名至少为 5 个字符
'
},
{
validator
:
this
.
userExists
},
],
})
}
/>
<
Input
{
...
nameProps
}
placeholder
=
"实时校验,输入 JasonWood 看看"
/>
</
FormItem
>
<
FormItem
{
...
formItemLayout
}
label
=
"邮箱:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
hasFeedback
>
<
Input
type
=
"email"
placeholder
=
"onBlur 与 onChange 相结合"
{
...
getFieldProps
(
'
email
'
,
{
validate
:
[{
rules
:
[
{
required
:
true
},
],
trigger
:
'
onBlur
'
,
},
{
rules
:
[
{
type
:
'
email
'
,
message
:
'
请输入正确的邮箱地址
'
},
],
trigger
:
[
'
onBlur
'
,
'
onChange
'
],
}]
})
}
/>
<
Input
{
...
emailProps
}
type
=
"email"
placeholder
=
"onBlur 与 onChange 相结合"
/>
</
FormItem
>
<
FormItem
{
...
formItemLayout
}
label
=
"密码:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
hasFeedback
>
<
Input
type
=
"password"
autoComplete
=
"off"
{
...
getFieldProps
(
'
passwd
'
,
{
rules
:
[
{
required
:
true
,
whitespace
:
true
,
message
:
'
请填写密码
'
},
{
validator
:
this
.
checkPass
.
bind
(
this
)
},
],
})
}
<
Input
{
...
passwdProps
}
type
=
"password"
autoComplete
=
"off"
onContextMenu
=
{
noop
}
onPaste
=
{
noop
}
onCopy
=
{
noop
}
onCut
=
{
noop
}
/>
</
FormItem
>
<
FormItem
{
...
formItemLayout
}
label
=
"确认密码:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
hasFeedback
>
<
Input
type
=
"password"
autoComplete
=
"off"
placeholder
=
"两次输入密码保持一致"
onContextMenu
=
{
noop
}
onPaste
=
{
noop
}
onCopy
=
{
noop
}
onCut
=
{
noop
}
{
...
getFieldProps
(
'
rePasswd
'
,
{
rules
:
[{
required
:
true
,
whitespace
:
true
,
message
:
'
请再次输入密码
'
,
},
{
validator
:
this
.
checkPass2
.
bind
(
this
),
}],
})
}
/>
<
Input
{
...
rePasswdProps
}
type
=
"password"
autoComplete
=
"off"
placeholder
=
"两次输入密码保持一致"
onContextMenu
=
{
noop
}
onPaste
=
{
noop
}
onCopy
=
{
noop
}
onCut
=
{
noop
}
/>
</
FormItem
>
<
FormItem
label
=
"备注:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
>
<
Input
type
=
"textarea"
placeholder
=
"随便写"
id
=
"textarea"
name
=
"textarea"
{
...
getFieldProps
(
'
textarea
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
真的不打算写点什么吗?
'
},
],
})
}
/>
{
...
formItemLayout
}
label
=
"备注:"
>
<
Input
{
...
textareaProps
}
type
=
"textarea"
placeholder
=
"随便写"
id
=
"textarea"
name
=
"textarea"
/>
</
FormItem
>
<
FormItem
wrapperCol
=
{
{
span
:
12
,
offset
:
7
}
}
>
<
Button
type
=
"primary"
onClick
=
{
this
.
handleSubmit
.
bind
(
this
)
}
>
确定
</
Button
>
<
FormItem
wrapperCol
=
{
{
span
:
12
,
offset
:
7
}
}
>
<
Button
type
=
"primary"
onClick
=
{
this
.
handleSubmit
.
bind
(
this
)
}
>
确定
</
Button
>
<
Button
type
=
"ghost"
onClick
=
{
this
.
handleReset
.
bind
(
this
)
}
>
重置
</
Button
>
<
Button
type
=
"ghost"
onClick
=
{
this
.
handleReset
.
bind
(
this
)
}
>
重置
</
Button
>
</
FormItem
>
</
Form
>
);
...
...
components/form/demo/validate-customized.md
浏览文件 @
4bcbf6ba
...
...
@@ -143,6 +143,10 @@ let Demo = React.createClass({
validator
:
this
.
checkPass2
,
}],
});
const
formItemLayout
=
{
labelCol
:
{
span
:
6
},
wrapperCol
:
{
span
:
18
},
};
return
(
<
div
>
<
Button
type
=
"primary"
onClick
=
{
this
.
showModal
}
>
修改密码
</
Button
>
...
...
@@ -151,9 +155,8 @@ let Demo = React.createClass({
<
Row
>
<
Col
span
=
"18"
>
<
FormItem
label
=
"密码:"
labelCol
=
{
{
span
:
6
}
}
wrapperCol
=
{
{
span
:
18
}
}
>
{
...
formItemLayout
}
label
=
"密码:"
>
<
Input
{
...
passProps
}
type
=
"password"
onContextMenu
=
{
noop
}
onPaste
=
{
noop
}
onCopy
=
{
noop
}
onCut
=
{
noop
}
autoComplete
=
"off"
id
=
"pass"
/>
...
...
@@ -167,9 +170,8 @@ let Demo = React.createClass({
<
Row
>
<
Col
span
=
"18"
>
<
FormItem
label
=
"确认密码:"
labelCol
=
{
{
span
:
6
}
}
wrapperCol
=
{
{
span
:
18
}
}
>
{
...
formItemLayout
}
label
=
"确认密码:"
>
<
Input
{
...
rePassProps
}
type
=
"password"
onContextMenu
=
{
noop
}
onPaste
=
{
noop
}
onCopy
=
{
noop
}
onCut
=
{
noop
}
autoComplete
=
"off"
id
=
"rePass"
/>
...
...
components/form/demo/validate-other.md
浏览文件 @
4bcbf6ba
...
...
@@ -65,19 +65,48 @@ let Demo = React.createClass({
}],
}];
const
{
getFieldProps
}
=
this
.
props
.
form
;
const
selectProps
=
getFieldProps
(
'
select
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
请选择您的国籍
'
}
],
});
const
multiSelectProps
=
getFieldProps
(
'
multiSelect
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
请选择您喜欢的颜色
'
,
type
:
'
array
'
},
]
});
const
radioProps
=
getFieldProps
(
'
radio
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
请选择您的性别
'
}
]
});
const
birthdayProps
=
getFieldProps
(
'
birthday
'
,
{
rules
:
[
{
required
:
true
,
type
:
'
date
'
,
message
:
'
你的生日是什么呢?
'
,
},
{
validator
:
this
.
checkBirthday
,
}
]
});
const
primeNumberProps
=
getFieldProps
(
'
primeNumber
'
,
{
rules
:
[{
validator
:
this
.
checkPrime
}],
});
const
addressProps
=
getFieldProps
(
'
address
'
,
{
rules
:
[{
required
:
true
,
type
:
'
array
'
}],
});
const
formItemLayout
=
{
labelCol
:
{
span
:
7
},
wrapperCol
:
{
span
:
12
},
};
return
(
<
Form
horizontal
form
=
{
this
.
props
.
form
}
>
<
FormItem
label
=
"国籍:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
>
<
Select
placeholder
=
"请选择国家"
style
=
{
{
width
:
'
100%
'
}
}
{
...
getFieldProps
(
'
select
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
请选择您的国籍
'
}
],
})
}
>
{
...
formItemLayout
}
label
=
"国籍:"
>
<
Select
{
...
selectProps
}
placeholder
=
"请选择国家"
style
=
{
{
width
:
'
100%
'
}
}
>
<
Option
value
=
"china"
>
中国
</
Option
>
<
Option
value
=
"use"
>
美国
</
Option
>
<
Option
value
=
"japan"
>
日本
</
Option
>
...
...
@@ -87,16 +116,9 @@ let Demo = React.createClass({
</
FormItem
>
<
FormItem
label
=
"喜欢的颜色:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
>
<
Select
multiple
placeholder
=
"请选择颜色"
style
=
{
{
width
:
'
100%
'
}
}
{
...
getFieldProps
(
'
multiSelect
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
请选择您喜欢的颜色
'
,
type
:
'
array
'
},
]
})
}
>
{
...
formItemLayout
}
label
=
"喜欢的颜色:"
>
<
Select
{
...
multiSelectProps
}
multiple
placeholder
=
"请选择颜色"
style
=
{
{
width
:
'
100%
'
}
}
>
<
Option
value
=
"red"
>
红色
</
Option
>
<
Option
value
=
"orange"
>
橙色
</
Option
>
<
Option
value
=
"yellow"
>
黄色
</
Option
>
...
...
@@ -106,25 +128,17 @@ let Demo = React.createClass({
</
FormItem
>
<
FormItem
label
=
"性别:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
>
<
RadioGroup
{
...
getFieldProps
(
'
radio
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
请选择您的性别
'
}
]
})
}
>
{
...
formItemLayout
}
label
=
"性别:"
>
<
RadioGroup
{
...
radioProps
}
>
<
Radio
value
=
"male"
>
男
</
Radio
>
<
Radio
value
=
"female"
>
女
</
Radio
>
</
RadioGroup
>
</
FormItem
>
<
FormItem
label
=
"兴趣爱好:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
>
{
...
formItemLayout
}
label
=
"兴趣爱好:"
>
<
Checkbox
{
...
getFieldProps
(
'
eat
'
,
{
valuePropName
:
'
checked
'
,
})
}
/>
吃饭饭
...
...
@@ -137,44 +151,21 @@ let Demo = React.createClass({
</
FormItem
>
<
FormItem
label
=
"生日:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
>
<
DatePicker
{
...
getFieldProps
(
'
birthday
'
,
{
rules
:
[
{
required
:
true
,
type
:
'
date
'
,
message
:
'
你的生日是什么呢?
'
,
},
{
validator
:
this
.
checkBirthday
,
}
]
})
}
/>
{
...
formItemLayout
}
label
=
"生日:"
>
<
DatePicker
{
...
birthdayProps
}
/>
</
FormItem
>
<
FormItem
label
=
"8~12间的质数:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
>
<
InputNumber
min
=
{
8
}
max
=
{
12
}
{
...
getFieldProps
(
'
primeNumber
'
,
{
rules
:
[{
validator
:
this
.
checkPrime
}],
})
}
/>
{
...
formItemLayout
}
label
=
"8~12间的质数:"
>
<
InputNumber
{
...
primeNumberProps
}
min
=
{
8
}
max
=
{
12
}
/>
</
FormItem
>
<
FormItem
label
=
"选择地址:"
labelCol
=
{
{
span
:
7
}
}
wrapperCol
=
{
{
span
:
12
}
}
>
<
Cascader
options
=
{
address
}
{
...
getFieldProps
(
'
address
'
,
{
rules
:
[{
required
:
true
,
type
:
'
array
'
}],
})
}
/>
{
...
formItemLayout
}
label
=
"选择地址:"
>
<
Cascader
{
...
addressProps
}
options
=
{
address
}
/>
</
FormItem
>
<
FormItem
...
...
components/steps/demo/icon.md
浏览文件 @
4bcbf6ba
# 带
ICON
图标的步骤条
# 带图标的步骤条
-
order: 2
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录