Skip to content

Commit

Permalink
Message: fix close instace offsetHeight(ElemeFE#17564) (ElemeFE#17852)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzwgq222 authored and hzsrc committed Feb 2, 2023
1 parent 7feb6d4 commit c671341
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/message/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ const Message = function(options) {
Message.close = function(id, userOnClose) {
let len = instances.length;
let index = -1;
let removedHeight;
for (let i = 0; i < len; i++) {
if (id === instances[i].id) {
removedHeight = instances[i].$el.offsetHeight;
index = i;
if (typeof userOnClose === 'function') {
userOnClose(instances[i]);
Expand All @@ -69,7 +71,6 @@ Message.close = function(id, userOnClose) {
}
}
if (len <= 1 || index === -1 || index > instances.length - 1) return;
const removedHeight = instances[index].$el.offsetHeight;
for (let i = index; i < len - 1 ; i++) {
let dom = instances[i].$el;
dom.style['top'] =
Expand Down

0 comments on commit c671341

Please sign in to comment.