Browse Source
* fix: respect notification placement in App * style: sort imports * fix: prioritize global config Fixes regression on global config test from previous change * test: check if notification placement works * lint: use consistent-type-import * style: remove extra new lines in import block * docs: update config demo * chore: fix lint --------- Co-authored-by: 二货机器人 <smith3816@gmail.com>pull/43599/head
Rajil Bajracharya
1 year ago
committed by
GitHub
9 changed files with 166 additions and 6 deletions
@ -1,7 +1,7 @@ |
|||
## zh-CN |
|||
|
|||
获取 `message`、`notification`、`modal` 静态方法。 |
|||
获取 `message`、`notification`、`modal` 实例。 |
|||
|
|||
## en-US |
|||
|
|||
Static method for `message`, `notification`, `modal`. |
|||
Get instance for `message`, `notification`, `modal`. |
|||
|
@ -0,0 +1,7 @@ |
|||
## zh-CN |
|||
|
|||
对 `message`、`notification` 进行配置。 |
|||
|
|||
## en-US |
|||
|
|||
Config for `message`, `notification`. |
@ -0,0 +1,36 @@ |
|||
import React from 'react'; |
|||
import { App, Button, Space } from 'antd'; |
|||
|
|||
// Sub page
|
|||
const MyPage = () => { |
|||
const { message, notification } = App.useApp(); |
|||
|
|||
const showMessage = () => { |
|||
message.success('Success!'); |
|||
}; |
|||
|
|||
const showNotification = () => { |
|||
notification.info({ |
|||
message: `Notification`, |
|||
description: 'Hello, Ant Design!!', |
|||
}); |
|||
}; |
|||
|
|||
return ( |
|||
<Space> |
|||
<Button type="primary" onClick={showMessage}> |
|||
Message for only one |
|||
</Button> |
|||
<Button type="primary" onClick={showNotification}> |
|||
Notification for bottomLeft |
|||
</Button> |
|||
</Space> |
|||
); |
|||
}; |
|||
|
|||
// Entry component
|
|||
export default () => ( |
|||
<App message={{ maxCount: 1 }} notification={{ placement: 'bottomLeft' }}> |
|||
<MyPage /> |
|||
</App> |
|||
); |
Loading…
Reference in new issue