File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,10 @@ export default {
32
32
disabled (value ) {
33
33
if (value) {
34
34
this .disable ();
35
- this .teardownObserver ();
35
+ // Ensure all event done.
36
+ this .$nextTick (() => {
37
+ this .teardownObserver ();
38
+ });
36
39
} else {
37
40
this .bootObserver ();
38
41
this .move ();
@@ -51,6 +54,9 @@ export default {
51
54
this .maybeMove ();
52
55
},
53
56
beforeDestroy () {
57
+ // Fix nodes reference
58
+ this .nodes = this .getComponentChildrenNode ();
59
+
54
60
// Move back
55
61
this .disable ();
56
62
@@ -145,7 +151,9 @@ export default {
145
151
this .childObserver = new MutationObserver (mutations => {
146
152
const childChangeRecord = mutations .find (i => i .target === this .$el );
147
153
if (childChangeRecord) {
148
- this .nodes = Array .from (this .$el .childNodes );
154
+ // Remove old nodes before update position.
155
+ this .nodes .forEach ((node ) => node .parentNode && node .parentNode .removeChild (node));
156
+ this .nodes = this .getComponentChildrenNode ();
149
157
this .maybeMove ();
150
158
}
151
159
});
@@ -167,6 +175,11 @@ export default {
167
175
this .childObserver = null ;
168
176
}
169
177
},
178
+ getComponentChildrenNode () {
179
+ return this .$vnode .componentOptions .children
180
+ .map ((i ) => i .elm )
181
+ .filter ((i ) => i);
182
+ },
170
183
},
171
184
};
172
185
</script >
You can’t perform that action at this time.
0 commit comments