Move ReactComponent to Vue injector
This commit is contained in:
parent
67debca9d9
commit
c2ccfd02da
|
@ -1,4 +1,4 @@
|
|||
export { ReactComponent } from './vue';
|
||||
export { ReactComponent } from './vueinjector';
|
||||
|
||||
export * from './components/common';
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import { WebpackModules } from 'modules';
|
||||
import Vue from 'vue';
|
||||
import VTooltip from 'v-tooltip';
|
||||
import DOM from './dom';
|
||||
import VueInjector from './vueinjector';
|
||||
|
||||
Vue.use(VTooltip, {
|
||||
defaultContainer: 'bd-tooltips',
|
||||
|
@ -45,22 +45,6 @@ Vue.use(VTooltip, {
|
|||
}
|
||||
});
|
||||
|
||||
export const ReactComponent = {
|
||||
props: ['component', 'component-props', 'component-children', 'react-element'],
|
||||
render(createElement) {
|
||||
return createElement('div');
|
||||
},
|
||||
mounted() {
|
||||
const { React, ReactDOM } = WebpackModules;
|
||||
|
||||
ReactDOM.unmountComponentAtNode(this.$el);
|
||||
ReactDOM.render(this.reactElement || React.createElement(this.component, this.componentProps, ...(this.componentChildren || [])), this.$el);
|
||||
},
|
||||
beforeDestroy() {
|
||||
WebpackModules.ReactDOM.unmountComponentAtNode(this.$el);
|
||||
}
|
||||
};
|
||||
|
||||
Vue.component('ReactComponent', ReactComponent);
|
||||
Vue.use(VueInjector);
|
||||
|
||||
export default Vue;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
|
||||
import { WebpackModules } from 'modules';
|
||||
import Vue from './vue';
|
||||
import Vue from 'vue';
|
||||
|
||||
export default class {
|
||||
|
||||
|
@ -93,4 +93,24 @@ export default class {
|
|||
}
|
||||
}
|
||||
|
||||
static install(Vue) {
|
||||
Vue.component('ReactComponent', ReactComponent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const ReactComponent = {
|
||||
props: ['component', 'component-props', 'component-children', 'react-element'],
|
||||
render(createElement) {
|
||||
return createElement('div');
|
||||
},
|
||||
mounted() {
|
||||
const { React, ReactDOM } = WebpackModules;
|
||||
|
||||
ReactDOM.unmountComponentAtNode(this.$el);
|
||||
ReactDOM.render(this.reactElement || React.createElement(this.component, this.componentProps, ...(this.componentChildren || [])), this.$el);
|
||||
},
|
||||
beforeDestroy() {
|
||||
WebpackModules.ReactDOM.unmountComponentAtNode(this.$el);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue