Notification: fix message text show
This commit is contained in:
parent
a2e982df6e
commit
13741ec00c
@ -8,6 +8,7 @@ import Layout from './Layout';
|
|||||||
|
|
||||||
message.config({
|
message.config({
|
||||||
top: 70,
|
top: 70,
|
||||||
|
maxCount: 3,
|
||||||
});
|
});
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { notification } from 'antd';
|
import { notification } from 'antd';
|
||||||
import { ArgsProps, NotificationInstance } from 'antd/lib/notification';
|
import { ArgsProps, NotificationInstance } from 'antd/lib/notification';
|
||||||
import { NOTIFICATION_DEBOUNCE } from 'core/constants/debounce';
|
import { NOTIFICATION_DEBOUNCE } from 'core/constants/debounce';
|
||||||
import { debounce } from 'lodash';
|
|
||||||
|
|
||||||
const defaultOptions: Partial<ArgsProps> = {
|
const defaultOptions: Partial<ArgsProps> = {
|
||||||
placement: 'bottomRight',
|
placement: 'bottomRight',
|
||||||
@ -11,7 +10,9 @@ type NotificationOptions = ArgsProps & {
|
|||||||
type: keyof NotificationInstance;
|
type: keyof NotificationInstance;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openNotification = debounce((options: NotificationOptions) => {
|
export const openNotification = (options: NotificationOptions) => {
|
||||||
if (!options.key) options.key = JSON.stringify(options);
|
setTimeout(() => {
|
||||||
notification[options.type]({ ...defaultOptions, ...options });
|
if (!options.key) options.key = JSON.stringify(options);
|
||||||
}, NOTIFICATION_DEBOUNCE);
|
notification[options.type]({ ...defaultOptions, ...options });
|
||||||
|
}, NOTIFICATION_DEBOUNCE);
|
||||||
|
};
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
export const DEFAULT_DEBOUNCE_DELAY = 350;
|
export const DEFAULT_DEBOUNCE_DELAY = 350;
|
||||||
export const NOTIFICATION_DEBOUNCE = 750;
|
export const NOTIFICATION_DEBOUNCE = 100;
|
||||||
export const ACTION_DELAY = 1200;
|
export const ACTION_DELAY = 1200;
|
||||||
|
|||||||
Reference in New Issue
Block a user