mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 01:11:26 +08:00
49e8c13c24
* feat: update demo * feat: update app * feat: update app * feat: update app * feat: update app * Update index.tsx * feat: update doc * feat: update doc * feat: reset doc * feat: update doc * feat: merge feature * feat: update doc * feat: update cover img * feat: update doc * feat: update doc * feat: update doc * feat: update snapshots * feat: update doc Co-authored-by: lijianan <574980606@qq.com>
48 lines
965 B
TypeScript
48 lines
965 B
TypeScript
import React from 'react';
|
|
import { App, Button, Space } from 'antd';
|
|
|
|
// Sub page
|
|
const MyPage = () => {
|
|
const { message, modal, notification } = App.useApp();
|
|
|
|
const showMessage = () => {
|
|
message.success('Success!');
|
|
};
|
|
|
|
const showModal = () => {
|
|
modal.warning({
|
|
title: 'This is a warning message',
|
|
content: 'some messages...some messages...',
|
|
});
|
|
};
|
|
|
|
const showNotification = () => {
|
|
notification.info({
|
|
message: `Notification topLeft`,
|
|
description: 'Hello, Ant Design!!',
|
|
placement: 'topLeft',
|
|
});
|
|
};
|
|
|
|
return (
|
|
<Space>
|
|
<Button type="primary" onClick={showMessage}>
|
|
Open message
|
|
</Button>
|
|
<Button type="primary" onClick={showModal}>
|
|
Open modal
|
|
</Button>
|
|
<Button type="primary" onClick={showNotification}>
|
|
Open notification
|
|
</Button>
|
|
</Space>
|
|
);
|
|
};
|
|
|
|
// Entry component
|
|
export default () => (
|
|
<App>
|
|
<MyPage />
|
|
</App>
|
|
);
|