Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
6eca4077
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,发现更多精彩内容 >>
提交
6eca4077
编写于
2月 20, 2017
作者:
F
feng zhi hao
提交者:
GitHub
2月 20, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: rewrite Checkbox demos to ES6 component (#4944)
上级
0d2da7ad
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
34 deletion
+32
-34
components/checkbox/demo/check-all.md
components/checkbox/demo/check-all.md
+12
-14
components/checkbox/demo/controller.md
components/checkbox/demo/controller.md
+13
-15
components/checkbox/demo/disabled.md
components/checkbox/demo/disabled.md
+7
-5
未找到文件。
components/checkbox/demo/check-all.md
浏览文件 @
6eca4077
...
@@ -20,14 +20,12 @@ const CheckboxGroup = Checkbox.Group;
...
@@ -20,14 +20,12 @@ const CheckboxGroup = Checkbox.Group;
const
plainOptions
=
[
'
Apple
'
,
'
Pear
'
,
'
Orange
'
];
const
plainOptions
=
[
'
Apple
'
,
'
Pear
'
,
'
Orange
'
];
const
defaultCheckedList
=
[
'
Apple
'
,
'
Orange
'
];
const
defaultCheckedList
=
[
'
Apple
'
,
'
Orange
'
];
const
App
=
React
.
createClass
({
class
App
extends
React
.
Component
{
getInitialState
()
{
state
=
{
return
{
checkedList
:
defaultCheckedList
,
checkedList
:
defaultCheckedList
,
indeterminate
:
true
,
indeterminate
:
true
,
checkAll
:
false
,
checkAll
:
false
,
};
};
},
render
()
{
render
()
{
return
(
return
(
<
div
>
<
div
>
...
@@ -44,22 +42,22 @@ const App = React.createClass({
...
@@ -44,22 +42,22 @@ const App = React.createClass({
<
CheckboxGroup
options
=
{
plainOptions
}
value
=
{
this
.
state
.
checkedList
}
onChange
=
{
this
.
onChange
}
/>
<
CheckboxGroup
options
=
{
plainOptions
}
value
=
{
this
.
state
.
checkedList
}
onChange
=
{
this
.
onChange
}
/>
</
div
>
</
div
>
);
);
}
,
}
onChange
(
checkedList
)
{
onChange
=
(
checkedList
)
=>
{
this
.
setState
({
this
.
setState
({
checkedList
,
checkedList
,
indeterminate
:
!!
checkedList
.
length
&&
(
checkedList
.
length
<
plainOptions
.
length
),
indeterminate
:
!!
checkedList
.
length
&&
(
checkedList
.
length
<
plainOptions
.
length
),
checkAll
:
checkedList
.
length
===
plainOptions
.
length
,
checkAll
:
checkedList
.
length
===
plainOptions
.
length
,
});
});
}
,
}
onCheckAllChange
(
e
)
{
onCheckAllChange
=
(
e
)
=>
{
this
.
setState
({
this
.
setState
({
checkedList
:
e
.
target
.
checked
?
plainOptions
:
[],
checkedList
:
e
.
target
.
checked
?
plainOptions
:
[],
indeterminate
:
false
,
indeterminate
:
false
,
checkAll
:
e
.
target
.
checked
,
checkAll
:
e
.
target
.
checked
,
});
});
}
,
}
}
);
}
ReactDOM
.
render
(<
App
/>,
mountNode
);
ReactDOM
.
render
(<
App
/>,
mountNode
);
````
````
components/checkbox/demo/controller.md
浏览文件 @
6eca4077
...
@@ -16,13 +16,11 @@ Communicated with other components.
...
@@ -16,13 +16,11 @@ Communicated with other components.
````
jsx
````
jsx
import
{
Checkbox
,
Button
}
from
'
antd
'
;
import
{
Checkbox
,
Button
}
from
'
antd
'
;
const
App
=
React
.
createClass
({
class
App
extends
React
.
Component
{
getInitialState
()
{
state
=
{
return
{
checked
:
true
,
checked
:
true
,
disabled
:
false
,
disabled
:
false
,
};
};
},
render
()
{
render
()
{
const
label
=
`
${
this
.
state
.
checked
?
'
Checked
'
:
'
Unchecked
'
}
-
${
this
.
state
.
disabled
?
'
Disabled
'
:
'
Enabled
'
}
`
;
const
label
=
`
${
this
.
state
.
checked
?
'
Checked
'
:
'
Unchecked
'
}
-
${
this
.
state
.
disabled
?
'
Disabled
'
:
'
Enabled
'
}
`
;
return
(
return
(
...
@@ -50,20 +48,20 @@ const App = React.createClass({
...
@@ -50,20 +48,20 @@ const App = React.createClass({
</
p
>
</
p
>
</
div
>
</
div
>
);
);
}
,
}
toggleChecked
()
{
toggleChecked
=
()
=>
{
this
.
setState
({
checked
:
!
this
.
state
.
checked
});
this
.
setState
({
checked
:
!
this
.
state
.
checked
});
}
,
}
toggleDisable
()
{
toggleDisable
=
()
=>
{
this
.
setState
({
disabled
:
!
this
.
state
.
disabled
});
this
.
setState
({
disabled
:
!
this
.
state
.
disabled
});
}
,
}
onChange
(
e
)
{
onChange
=
(
e
)
=>
{
console
.
log
(
'
checked =
'
,
e
.
target
.
checked
);
console
.
log
(
'
checked =
'
,
e
.
target
.
checked
);
this
.
setState
({
this
.
setState
({
checked
:
e
.
target
.
checked
,
checked
:
e
.
target
.
checked
,
});
});
}
,
}
}
);
}
ReactDOM
.
render
(<
App
/>,
mountNode
);
ReactDOM
.
render
(<
App
/>,
mountNode
);
````
````
components/checkbox/demo/disabled.md
浏览文件 @
6eca4077
...
@@ -16,9 +16,11 @@ Disabled checkbox.
...
@@ -16,9 +16,11 @@ Disabled checkbox.
````
jsx
````
jsx
import
{
Checkbox
}
from
'
antd
'
;
import
{
Checkbox
}
from
'
antd
'
;
ReactDOM
.
render
(<
div
>
ReactDOM
.
render
(
<
Checkbox
defaultChecked
=
{
false
}
disabled
/>
<
div
>
<
br
/>
<
Checkbox
defaultChecked
=
{
false
}
disabled
/>
<
Checkbox
defaultChecked
disabled
/>
<
br
/>
</
div
>,
mountNode
);
<
Checkbox
defaultChecked
disabled
/>
</
div
>
,
mountNode
);
````
````
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录