mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
feat: Vite + vue 3 💚 (#10047)
Fixes https://github.com/chatwoot/chatwoot/issues/8436 Fixes https://github.com/chatwoot/chatwoot/issues/9767 Fixes https://github.com/chatwoot/chatwoot/issues/10156 Fixes https://github.com/chatwoot/chatwoot/issues/6031 Fixes https://github.com/chatwoot/chatwoot/issues/5696 Fixes https://github.com/chatwoot/chatwoot/issues/9250 Fixes https://github.com/chatwoot/chatwoot/issues/9762 --------- Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
34
app/javascript/entrypoints/superadmin_pages.js
Normal file
34
app/javascript/entrypoints/superadmin_pages.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'chart.js';
|
||||
import { createApp, h } from 'vue';
|
||||
import VueDOMPurifyHTML from 'vue-dompurify-html';
|
||||
|
||||
import PlaygroundIndex from '../superadmin_pages/views/playground/Index.vue';
|
||||
import DashboardIndex from '../superadmin_pages/views/dashboard/Index.vue';
|
||||
|
||||
const ComponentMapping = {
|
||||
PlaygroundIndex: PlaygroundIndex,
|
||||
DashboardIndex: DashboardIndex,
|
||||
};
|
||||
|
||||
const renderComponent = (componentName, props) => {
|
||||
const app = createApp({
|
||||
data() {
|
||||
return { props: props };
|
||||
},
|
||||
render() {
|
||||
return h(ComponentMapping[componentName], { componentData: this.props });
|
||||
},
|
||||
});
|
||||
|
||||
app.use(VueDOMPurifyHTML);
|
||||
app.mount('#app');
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const element = document.getElementById('app');
|
||||
if (element) {
|
||||
const componentName = element.dataset.componentName;
|
||||
const props = JSON.parse(element.dataset.props);
|
||||
renderComponent(componentName, props);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user