Fix error when unmounting a component

This commit is contained in:
Samuel Elliott 2018-05-15 16:54:22 +01:00
parent 581c94f6b3
commit f2159f1031
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
1 changed files with 9 additions and 4 deletions

View File

@ -51,15 +51,20 @@ export default class {
}
componentDidMount() {
const element = ReactDOM.findDOMNode(this);
if (!element) return;
this.vueInstance.$mount(element);
this.vueInstance.$mount(this.vueMount);
}
componentDidUpdate() {
this.vueInstance.$mount(this.vueMount);
}
get vueMount() {
const element = ReactDOM.findDOMNode(this);
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() {