Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
42024530
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,发现更多精彩内容 >>
提交
42024530
编写于
7月 29, 2015
作者:
Z
zhujun24
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
notification
上级
19a2604b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
139 addition
and
50 deletion
+139
-50
components/notification/demo/basic.md
components/notification/demo/basic.md
+5
-4
components/notification/demo/onclose.md
components/notification/demo/onclose.md
+40
-0
components/notification/demo/with-btn-onclose.md
components/notification/demo/with-btn-onclose.md
+48
-0
components/notification/demo/with-btn.md
components/notification/demo/with-btn.md
+11
-13
components/notification/demo/with-icon.md
components/notification/demo/with-icon.md
+6
-5
components/notification/index.jsx
components/notification/index.jsx
+12
-11
components/notification/index.md
components/notification/index.md
+6
-5
style/components/notification.less
style/components/notification.less
+11
-12
未找到文件。
components/notification/demo/basic.md
浏览文件 @
42024530
...
...
@@ -19,10 +19,10 @@ if(!Notification.notification){
});
}
function
openNotifica
tion
()
{
var
openNotification
=
func
tion
()
{
var
args
=
{
title
:
'
这是标题
'
,
message
:
'
这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案
'
message
:
"
这是标题
"
,
description
:
"
这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案
"
};
Notification
.
show
(
args
);
}
...
...
@@ -30,5 +30,6 @@ function openNotification() {
React
.
render
(
<
div
>
<
button
className
=
'ant-btn ant-btn-primary'
onClick
=
{
openNotification
}
>
基本
</
button
>
</
div
>,
document
.
getElementById
(
'
components-notification-demo-basic
'
));
</
div
>,
document
.
getElementById
(
'
components-notification-demo-basic
'
));
````
\ No newline at end of file
components/notification/demo/onclose.md
0 → 100644
浏览文件 @
42024530
# 回调函数
-
order: 2
点击关闭按钮时触发回调函数。
---
````
jsx
var
Notification
=
require
(
'
antd/lib/notification
'
);
if
(
!
Notification
.
notification
){
Notification
.
notification
=
Notification
.
newInstance
({
prefixCls
:
'
ant-notification
'
,
style
:
{
top
:
0
,
right
:
0
}
});
}
var
close
=
function
()
{
console
.
log
(
"
我被默认的关闭按钮关闭了!
"
);
}
var
openNotification
=
function
()
{
var
args
=
{
message
:
"
这是标题
"
,
description
:
"
这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案
"
,
defaultClose
:
close
};
Notification
.
show
(
args
);
}
React
.
render
(
<
div
>
<
button
className
=
'ant-btn ant-btn-primary'
onClick
=
{
openNotification
}
>
关闭按钮触发回调函数
</
button
>
</
div
>,
document
.
getElementById
(
'
components-notification-demo-onclose
'
));
````
\ No newline at end of file
components/notification/demo/with-btn-onclose.md
0 → 100644
浏览文件 @
42024530
# 自定义关闭按钮同时触发回调函数
-
order: 4
关闭自定义的关闭按钮时触发回调函数,同时还可以在默认关闭按钮上添加另一个回调函数。
---
````
jsx
var
Notification
=
require
(
'
antd/lib/notification
'
);
if
(
!
Notification
.
notification
){
Notification
.
notification
=
Notification
.
newInstance
({
prefixCls
:
'
ant-notification
'
,
style
:
{
top
:
0
,
right
:
0
}
});
}
var
customClose
=
function
()
{
console
.
log
(
"
我被自定义的关闭按钮关闭了!
"
);
}
var
close
=
function
()
{
console
.
log
(
"
我被默认的关闭按钮关闭了!
"
);
}
var
btn
=
<
button
className
=
"ant-btn ant-btn-primary ant-btn-sm"
>
自定义关闭按钮并触发回调函数
</
button
>;
var
openNotification
=
function
()
{
var
args
=
{
message
:
"
这是标题
"
,
description
:
"
这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案
"
,
btn
:
btn
,
customClose
:
customClose
,
defaultClose
:
close
};
Notification
.
show
(
args
);
}
React
.
render
(
<
div
>
<
button
className
=
"ant-btn ant-btn-primary"
onClick
=
{
openNotification
}
>
关闭自定义的按钮触发回调函数
</
button
>
</
div
>,
document
.
getElementById
(
'
components-notification-demo-with-btn-onclose
'
));
````
\ No newline at end of file
components/notification/demo/with-btn.md
浏览文件 @
42024530
#
关闭触发回调函数
#
自定义关闭按钮
-
order:
2
-
order:
3
点击关闭按钮触发回调函数
。
自定义关闭按钮的样式和文字
。
---
...
...
@@ -19,22 +19,20 @@ if(!Notification.notification){
});
}
function
callback
()
{
alert
(
'
我要关闭了!
'
);
}
var
btn
=
<
button
className
=
"ant-btn ant-btn-primary ant-btn-sm"
>
自定义关闭按钮
</
button
>;
function
openNotifica
tion
()
{
var
openNotification
=
func
tion
()
{
var
args
=
{
title
:
'
这是标题
'
,
message
:
'
这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案
'
,
btn
:
true
,
callback
:
callback
message
:
"
这是标题
"
,
description
:
"
这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案
"
,
btn
:
btn
};
Notification
.
show
(
args
);
}
React
.
render
(
<
div
>
<
button
className
=
'ant-btn ant-btn-primary'
onClick
=
{
openNotification
}
>
关闭按钮触发回调函数
</
button
>
</
div
>,
document
.
getElementById
(
'
components-notification-demo-with-btn
'
));
<
button
className
=
"ant-btn ant-btn-primary"
onClick
=
{
openNotification
}
>
自定义关闭按钮
</
button
>
</
div
>,
document
.
getElementById
(
'
components-notification-demo-with-btn
'
));
````
\ No newline at end of file
components/notification/demo/with-icon.md
浏览文件 @
42024530
...
...
@@ -19,10 +19,10 @@ if(!Notification.notification){
});
}
function
openNotifica
tion
()
{
var
openNotification
=
func
tion
()
{
var
args
=
{
title
:
'
这是标题
'
,
message
:
'
这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案
'
,
message
:
"
这是标题
"
,
description
:
"
这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案
"
,
icon
:
true
};
Notification
.
show
(
args
);
...
...
@@ -30,6 +30,7 @@ function openNotification() {
React
.
render
(
<
div
>
<
button
className
=
'ant-btn ant-btn-primary'
onClick
=
{
openNotification
}
>
带有Icon的通知提醒框
</
button
>
</
div
>,
document
.
getElementById
(
'
components-notification-demo-with-icon
'
));
<
button
className
=
"ant-btn ant-btn-primary"
onClick
=
{
openNotification
}
>
带有Icon的通知提醒框
</
button
>
</
div
>,
document
.
getElementById
(
'
components-notification-demo-with-icon
'
));
````
\ No newline at end of file
components/notification/index.jsx
浏览文件 @
42024530
import
Notification
from
'
rc-notification
'
;
function
close
(
key
,
callback
)
{
function
close
(
key
,
c
ustomC
allback
)
{
Notification
.
notification
.
removeNotice
(
key
);
if
(
callback
)
{
callback
();
if
(
c
ustomC
allback
)
{
c
ustomC
allback
();
}
}
...
...
@@ -13,12 +13,12 @@ Notification.show = function (args) {
Notification
.
notification
.
notice
({
content
:
<
div
>
<
i
className
=
{
'
anticon anticon-question-circle-o
'
+
prefixCls
+
'
icon
'
}
></
i
>
<
p
className
=
{
prefixCls
+
'
title
'
}
>
{
args
.
title
}
</
p
>
<
p
className
=
{
prefixCls
+
'
message
'
}
>
{
args
.
message
}
</
p
>
<
p
className
=
{
prefixCls
+
'
description
'
}
>
{
args
.
description
}
</
p
>
</
div
>,
duration
:
null
,
closable
:
true
,
onClose
:
args
.
callback
,
onClose
:
args
.
defaultClose
,
style
:
{}
});
}
else
{
...
...
@@ -26,12 +26,12 @@ Notification.show = function (args) {
let
prefixCls
=
'
ant-notification-notice-content-
'
;
Notification
.
notification
.
notice
({
content
:
<
div
>
<
p
className
=
{
prefixCls
+
'
title
'
}
>
{
args
.
title
}
</
p
>
<
p
className
=
{
prefixCls
+
'
message
'
}
>
{
args
.
message
}
</
p
>
<
p
className
=
{
prefixCls
+
'
description
'
}
>
{
args
.
description
}
</
p
>
</
div
>,
duration
:
null
,
closable
:
true
,
onClose
:
args
.
callback
,
onClose
:
args
.
defaultClose
,
style
:
{}
});
}
else
{
...
...
@@ -39,14 +39,15 @@ Notification.show = function (args) {
let
key
=
'
manual
'
+
new
Date
().
getTime
();
Notification
.
notification
.
notice
({
content
:
<
div
>
<
p
className
=
{
prefixCls
+
'
title
'
}
>
{
args
.
title
}
</
p
>
<
p
className
=
{
prefixCls
+
'
message
'
}
>
{
args
.
message
}
</
p
>
<
button
onClick
=
{
close
.
bind
(
null
,
key
,
args
.
callback
)
}
className
=
{
'
ant-btn ant-btn-primary ant-btn-sm
'
+
prefixCls
+
'
btn
'
}
>
立即操作
</
button
>
<
p
className
=
{
prefixCls
+
'
description
'
}
>
{
args
.
description
}
</
p
>
<
span
onClick
=
{
close
.
bind
(
null
,
key
,
args
.
customClose
)
}
className
=
{
prefixCls
+
'
btn
'
}
>
{
args
.
btn
}
</
span
>
</
div
>,
duration
:
null
,
closable
:
true
,
onClose
:
args
.
callback
,
onClose
:
args
.
defaultClose
,
key
:
key
,
style
:
{}
});
...
...
components/notification/index.md
浏览文件 @
42024530
...
...
@@ -15,8 +15,9 @@
| 参数 | 说明 | 类型 | 默认值 |
|----------- |--------------------------------------------- | ----------- |--------|
| title | 通知提醒内容,必选 | String | 无 |
| message | 通知提醒内容,必选 | String | 无 |
| callback | 关闭时触发的回调函数 | Function | 无 |
| icon | 框的左侧有Icon | Boolean | false |
| btn | 自定义关闭按钮 | Boolean | false |
| message | 通知提醒标题,必选 | String | 无 |
| description | 通知提醒内容,必选 | String | 无 |
| icon | 框的左侧有Icon | Boolean | false |
| btn | 自定义关闭按钮的文字 | String | 无 |
| defaultClose | 默认关闭按钮关闭时触发的回调函数 | Function | 无 |
| customClose | 自定义关闭按钮关闭时触发的回调函数 | Function | 无 |
style/components/notification.less
浏览文件 @
42024530
...
...
@@ -23,32 +23,32 @@
margin-top: @noticeMarginTop;
overflow: hidden;
&-content{
&-
title
{
&-content
{
&-
message
{
font-size: 14px;
color: @text-color;
margin-bottom: 4px;
}
&-
message
{
&-
description
{
font-size: @font-size-base;
color: @legend-color;
}
}
&-content-icon{
&-content-icon
{
position: relative;
&-
title
{
&-
message
{
font-size: 14px;
color: @text-color;
margin-left: 51px;
margin-bottom: 4px;
}
&-
message
{
&-
description
{
margin-left: 51px;
font-size: @font-size-base;
color: @legend-color;
}
&-icon{
&-icon
{
position: absolute;
left: 16px;
top: 50%;
...
...
@@ -58,7 +58,7 @@
}
}
&-close-x:after{
&-close-x:after
{
content: "\e61e";
font-family: "anticon";
cursor: pointer;
...
...
@@ -72,9 +72,8 @@
color: #999;
outline: none;
}
&-content-btn{
&-content-btn {
float: right;
margin-top: 16px;
}
...
...
@@ -96,7 +95,7 @@
margin-top: @noticeMarginTop;
padding-top: @noticePadding;
padding-bottom: @noticePadding;
max-height: 1
0
0px;
max-height: 1
5
0px;
transition: all .3s ease-in-out;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录