Skip to content

Commit

Permalink
Message: fix close instace offsetHeight(#17564) (#17852)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzwgq222 authored and island205 committed Oct 30, 2019
1 parent a78f4b9 commit 7f4d7b0
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 7f4d7b0

Please sign in to comment.