improve code style

This commit is contained in:
afc163 2015-08-06 15:19:45 +08:00
parent 287c9ec5fd
commit 9963c41029
5 changed files with 14 additions and 23 deletions

View File

@ -10,11 +10,10 @@
var notification = require('antd/lib/notification');
var openNotification = function() {
var args = {
notification.open({
message: "这是标题",
description: "这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案"
};
notification.open(args);
});
};
React.render(

View File

@ -21,19 +21,18 @@ var close = function() {
var onClose = function() {
// 默认按钮关闭时的业务处理
console.log("我被默认的关闭按钮关闭了!");
}
};
var btn = <button onClick={close} className="ant-btn ant-btn-primary ant-btn-sm">自定义关闭按钮并触发回调函数</button>;
var openNotification = function() {
var args = {
notification.open({
message: "这是标题",
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案",
btn: btn,
key: key,
onClose: onClose
};
notification.open(args);
});
};
React.render(

View File

@ -18,13 +18,12 @@ var close = function() {
var btn = <button onClick={close} className="ant-btn ant-btn-primary ant-btn-sm">自定义关闭按钮</button>;
var openNotification = function() {
var args = {
notification.open({
message: "这是标题",
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案",
btn: btn,
key: key
};
notification.open(args);
});
};
React.render(

View File

@ -2,7 +2,7 @@
- order: 2
通知提醒框左侧有Icon图标。
通知提醒框左侧有图标。
---
@ -11,11 +11,10 @@ var notification = require('antd/lib/notification');
var openNotificationWithIcon = function(type) {
return function(){
var args = {
notification[type]({
message: "这是标题",
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案"
};
notification[type](args);
});
};
};

View File

@ -3,8 +3,7 @@ import assign from 'object-assign';
import React from 'react';
let top = 24;
var notificationInstance;
let notificationInstance;
function getNotificationInstance() {
notificationInstance = notificationInstance || Notification.newInstance({
@ -41,9 +40,7 @@ function notice(args) {
getNotificationInstance().notice({
content: <div>
<i className={iconClass + prefixCls + 'icon-' + args.icon + prefixCls + 'icon'}></i>
<p className={prefixCls + 'message'}>{args.message}</p>
<p className={prefixCls + 'description'}>{args.description}</p>
</div>,
duration: null,
@ -57,7 +54,6 @@ function notice(args) {
getNotificationInstance().notice({
content: <div>
<p className={prefixCls + 'message'}>{args.message}</p>
<p className={prefixCls + 'description'}>{args.description}</p>
</div>,
duration: null,
@ -69,7 +65,6 @@ function notice(args) {
getNotificationInstance().notice({
content: <div>
<p className={prefixCls + 'message'}>{args.message}</p>
<p className={prefixCls + 'description'}>{args.description}</p>
<span className={prefixCls + 'btn'}>
{args.btn}
@ -99,7 +94,7 @@ var api = {
}
};
['success', 'info', 'warn', 'error'].forEach((type)=> {
['success', 'info', 'warn', 'error'].forEach((type) => {
api[type] = (args) => {
var newArgs = assign({}, args, {
icon: type