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