fix: alert close optimization (#24460) (#24460)

Co-authored-by: Yunfly <qinfy@knownsec.com>
This commit is contained in:
Yunfly 2020-07-10 17:26:39 +08:00 committed by GitHub
parent d66458435d
commit dd8e9f8568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View File

@ -88,13 +88,6 @@ const Alert: AlertInterface = ({
const prefixCls = getPrefixCls('alert', customizePrefixCls);
const handleClose = (e: React.MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
const dom = ref.current as HTMLElement;
dom.style.height = `${dom.offsetHeight}px`;
// Magic code
// 重复一次后才能正确设置 height
dom.style.height = `${dom.offsetHeight}px`;
setClosing(true);
props.onClose?.(e);
};

View File

@ -7,6 +7,7 @@
.reset-component;
position: relative;
max-height: 1000vh;
padding: 8px 15px 8px 37px;
word-wrap: break-word;
border-radius: @border-radius-base;
@ -146,7 +147,7 @@
}
&&-closing {
height: 0 !important;
max-height: 0;
margin: 0;
padding-top: 0;
padding-bottom: 0;