ant-design/components/notification/demo/top.md

26 lines
780 B
Markdown
Raw Normal View History

2015-08-03 15:17:12 +08:00
# 距离顶部距离
- order: 1
2015-08-03 18:00:22 +08:00
自定义通知框距离顶部的距离,在`config`方法里设置`top`的值, **只在初始化时设置有效** ,默认距离顶部`24px`。
2015-08-03 15:17:12 +08:00
---
````jsx
var notification = require('antd/lib/notification');
var openNotification = function() {
var args = {
message: "这是标题",
description: "这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案",
};
2015-08-03 18:00:22 +08:00
notification.config({
top:100
});
2015-08-03 15:17:12 +08:00
notification.open(args);
};
React.render(
<button className='ant-btn ant-btn-primary' onClick={openNotification}>距离顶部100px</button>
, document.getElementById('components-notification-demo-top'));
````