Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
e19186f7
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,体验更适合开发者的 AI 搜索 >>
提交
e19186f7
编写于
10月 27, 2015
作者:
A
afc163
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
confirmLoading is fully controlled by props now, fix #392
上级
0193df10
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
13 addition
and
36 deletion
+13
-36
components/modal/demo/async.md
components/modal/demo/async.md
+7
-4
components/modal/demo/basic.md
components/modal/demo/basic.md
+1
-2
components/modal/index.jsx
components/modal/index.jsx
+5
-30
未找到文件。
components/modal/demo/
custom
.md
→
components/modal/demo/
async
.md
浏览文件 @
e19186f7
...
...
@@ -2,7 +2,7 @@
-
order: 1
点击确定后异步关闭对话框。
点击确定后异步关闭对话框
,例如提交表单
。
---
...
...
@@ -26,11 +26,13 @@ var Test = React.createClass({
},
handleOk
()
{
this
.
setState
({
ModalText
:
'
对话框将在两秒后关闭
'
ModalText
:
'
对话框将在两秒后关闭
'
,
confirmLoading
:
true
});
setTimeout
(()
=>
{
this
.
setState
({
visible
:
false
visible
:
false
,
confirmLoading
:
false
});
},
2000
);
},
...
...
@@ -46,6 +48,7 @@ var Test = React.createClass({
<
Modal
title
=
"对话框标题"
visible
=
{
this
.
state
.
visible
}
onOk
=
{
this
.
handleOk
}
confirmLoading
=
{
this
.
state
.
confirmLoading
}
onCancel
=
{
this
.
handleCancel
}
>
<
p
>
{
this
.
state
.
ModalText
}
</
p
>
</
Modal
>
...
...
@@ -53,5 +56,5 @@ var Test = React.createClass({
}
});
ReactDOM
.
render
(<
Test
/>
,
document
.
getElementById
(
'
components-modal-demo-
custom
'
));
ReactDOM
.
render
(<
Test
/>
,
document
.
getElementById
(
'
components-modal-demo-
async
'
));
````
components/modal/demo/basic.md
浏览文件 @
e19186f7
...
...
@@ -22,7 +22,6 @@ var App = React.createClass({
handleOk
()
{
console
.
log
(
'
点击了确定
'
);
this
.
setState
({
confirmLoading
:
false
,
visible
:
false
});
},
...
...
@@ -35,7 +34,7 @@ var App = React.createClass({
return
<
div
>
<
Button
type
=
"primary"
onClick
=
{
this
.
showModal
}
>
显示对话框
</
Button
>
<
Modal
title
=
"第一个 Modal"
visible
=
{
this
.
state
.
visible
}
confirmLoading
=
{
this
.
state
.
confirmLoading
}
onOk
=
{
this
.
handleOk
}
onCancel
=
{
this
.
handleCancel
}
>
onOk
=
{
this
.
handleOk
}
onCancel
=
{
this
.
handleCancel
}
>
<
p
>
对话框的内容
</
p
>
<
p
>
对话框的内容
</
p
>
<
p
>
对话框的内容
</
p
>
...
...
components/modal/index.jsx
浏览文件 @
e19186f7
...
...
@@ -4,8 +4,7 @@ import { Dom } from 'rc-util';
import
confirm
from
'
./confirm
'
;
import
{
Button
}
from
'
../button
'
;
function
noop
()
{
}
function
noop
()
{}
let
mousePosition
;
let
mousePositionEventBinded
;
...
...
@@ -18,14 +17,9 @@ let AntModal = React.createClass({
onCancel
:
noop
,
width
:
520
,
transitionName
:
'
zoom
'
,
maskAnimation
:
'
fade
'
};
},
getInitialState
()
{
return
{
maskAnimation
:
'
fade
'
,
confirmLoading
:
false
,
visible
:
this
.
props
.
visibl
e
visible
:
fals
e
};
},
...
...
@@ -34,27 +28,9 @@ let AntModal = React.createClass({
},
handleOk
()
{
this
.
setState
({
confirmLoading
:
true
});
this
.
props
.
onOk
();
},
componentWillReceiveProps
(
nextProps
)
{
let
newState
=
{};
if
(
'
visible
'
in
nextProps
)
{
newState
.
visible
=
nextProps
.
visible
;
// 隐藏后默认去除按钮 loading 效果
if
(
!
nextProps
.
visible
)
{
newState
.
confirmLoading
=
false
;
}
}
if
(
'
confirmLoading
'
in
nextProps
)
{
newState
.
confirmLoading
=
!!
nextProps
.
confirmLoading
;
}
this
.
setState
(
newState
);
},
componentDidMount
()
{
if
(
mousePositionEventBinded
)
{
return
;
...
...
@@ -85,15 +61,14 @@ let AntModal = React.createClass({
<
Button
key
=
"confirm"
type
=
"primary"
size
=
"large"
loading
=
{
this
.
state
.
confirmLoading
}
loading
=
{
props
.
confirmLoading
}
onClick
=
{
this
.
handleOk
}
>
确定
</
Button
>
];
let
footer
=
props
.
footer
||
defaultFooter
;
let
visible
=
this
.
state
.
visible
;
return
<
Dialog
onClose
=
{
this
.
handleCancel
}
footer
=
{
footer
}
{
...
props
}
visible
=
{
visible
}
mousePosition
=
{
mousePosition
}
/>;
visible
=
{
props
.
visible
}
mousePosition
=
{
mousePosition
}
/>;
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录