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 xushuailing committed Jun 27, 2020
1 parent 6b8ca74 commit 6e978df
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 6e978df

Please sign in to comment.