Add Vue wrapper for React
This commit is contained in:
parent
204dd76e7b
commit
17597e2c30
|
@ -1,3 +1,5 @@
|
||||||
|
export { ReactComponent } from './vue';
|
||||||
|
|
||||||
export * from './components/common';
|
export * from './components/common';
|
||||||
|
|
||||||
export { default as SettingsPanel } from './components/bd/SettingsPanel.vue';
|
export { default as SettingsPanel } from './components/bd/SettingsPanel.vue';
|
||||||
|
|
|
@ -8,9 +8,10 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import DOM from 'dom';
|
import { WebpackModules } from 'modules';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import VTooltip from 'v-tooltip';
|
import VTooltip from 'v-tooltip';
|
||||||
|
import DOM from './dom';
|
||||||
|
|
||||||
Vue.use(VTooltip, {
|
Vue.use(VTooltip, {
|
||||||
defaultContainer: 'bd-tooltips',
|
defaultContainer: 'bd-tooltips',
|
||||||
|
@ -44,4 +45,22 @@ 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);
|
||||||
|
|
||||||
export default Vue;
|
export default Vue;
|
||||||
|
|
Loading…
Reference in New Issue