Fix error when unmounting a component
This commit is contained in:
parent
581c94f6b3
commit
f2159f1031
|
@ -51,15 +51,20 @@ export default class {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const element = ReactDOM.findDOMNode(this);
|
this.vueInstance.$mount(this.vueMount);
|
||||||
if (!element) return;
|
|
||||||
this.vueInstance.$mount(element);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
|
this.vueInstance.$mount(this.vueMount);
|
||||||
|
}
|
||||||
|
|
||||||
|
get vueMount() {
|
||||||
const element = ReactDOM.findDOMNode(this);
|
const element = ReactDOM.findDOMNode(this);
|
||||||
if (!element) return;
|
if (!element) return;
|
||||||
this.vueInstance.$mount(element);
|
if (element.firstChild) return element.firstChild;
|
||||||
|
const newElement = document.createElement('span');
|
||||||
|
element.appendChild(newElement);
|
||||||
|
return newElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
get vueInstance() {
|
get vueInstance() {
|
||||||
|
|
Loading…
Reference in New Issue