Skip to content

Commit 77c4977

Browse files
zouhangwithsweetdolymood
authored andcommitted
fix remove child error when destroyed
* improve destory handler * 🐛 improve code * imporve code
1 parent 04d3522 commit 77c4977

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/instantiate.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export default function instantiateComponent(Vue, Component, data, renderFn, opt
1818
},
1919
destroy() {
2020
this.$destroy()
21-
document.body.removeChild(this.$el)
21+
if (this.$el && this.$el.parentNode === document.body) {
22+
document.body.removeChild(this.$el)
23+
}
2224
}
2325
}
2426
})

0 commit comments

Comments
 (0)