mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
improve code style
This commit is contained in:
parent
287c9ec5fd
commit
9963c41029
@ -10,11 +10,10 @@
|
||||
var notification = require('antd/lib/notification');
|
||||
|
||||
var openNotification = function() {
|
||||
var args = {
|
||||
notification.open({
|
||||
message: "这是标题",
|
||||
description: "这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案"
|
||||
};
|
||||
notification.open(args);
|
||||
});
|
||||
};
|
||||
|
||||
React.render(
|
||||
@ -22,4 +21,4 @@ React.render(
|
||||
<button className='ant-btn ant-btn-primary' onClick={openNotification}>打开通知提醒框</button>
|
||||
</div>,
|
||||
document.getElementById('components-notification-demo-basic'));
|
||||
````
|
||||
````
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
@ -32,4 +31,4 @@ React.render(
|
||||
<button className="ant-btn ant-btn-primary" onClick={openNotification}>打开通知提醒框</button>
|
||||
</div>,
|
||||
document.getElementById('components-notification-demo-with-btn'));
|
||||
````
|
||||
````
|
||||
|
@ -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);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user