type(message): improve message.info type (#51468)

This commit is contained in:
Fog3211 2024-11-07 09:42:48 +08:00 committed by GitHub
parent 9067b0f9e5
commit 910a484b69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 3 deletions

View File

@ -36,6 +36,19 @@ describe('message.config', () => {
});
});
it('should be able to config top with string value', async () => {
message.config({
top: '10vh',
});
message.info('test message');
await awaitPromise();
expect(document.querySelector('.ant-message')).toHaveStyle({
top: '10vh',
});
});
it('should be able to config rtl', async () => {
message.config({
rtl: true,

View File

@ -108,7 +108,7 @@ message.config({
| maxCount | Max message show, drop oldest if exceed limit | number | - | |
| prefixCls | The prefix className of message node | string | `ant-message` | 4.5.0 |
| rtl | Whether to enable RTL mode | boolean | false | |
| top | Distance from top | number | 8 | |
| top | Distance from top | string \| number | 8 | |
## Design Token

View File

@ -109,7 +109,7 @@ message.config({
| maxCount | 最大显示数,超过限制时,最早的消息会被自动关闭 | number | - | |
| prefixCls | 消息节点的 className 前缀 | string | `ant-message` | 4.5.0 |
| rtl | 是否开启 RTL 模式 | boolean | false | |
| top | 消息距离顶部的位置 | number | 8 | |
| top | 消息距离顶部的位置 | string \| number | 8 | |
## 主题变量Design Token

View File

@ -3,7 +3,7 @@ import type * as React from 'react';
export type NoticeType = 'info' | 'success' | 'error' | 'warning' | 'loading';
export interface ConfigOptions {
top?: number;
top?: string | number;
duration?: number;
prefixCls?: string;
getContainer?: () => HTMLElement;