assets
9 months ago
components
9 months ago
composables
9 months ago
data
9 months ago
directives
9 months ago
router
9 months ago
stores
9 months ago
styles
9 months ago
types
9 months ago
utils
9 months ago
views
9 months ago
App.vue
9 months ago
main.ts
9 months ago
main.ts
42 lines
| 1 | import { HButton, HCard, HIcon, HSnackbar, HText, HToast, setTheme } from '@hostinger/hcomponents'; |
| 2 | import { createPinia } from 'pinia'; |
| 3 | import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'; |
| 4 | import { createApp } from 'vue'; |
| 5 | |
| 6 | import './styles/main.scss'; |
| 7 | |
| 8 | import App from './App.vue'; |
| 9 | import { setDirectives } from './directives'; |
| 10 | import router from './router'; |
| 11 | |
| 12 | const initializeVueApp = () => { |
| 13 | const app = createApp(App); |
| 14 | const pinia = createPinia(); |
| 15 | |
| 16 | pinia.use(piniaPluginPersistedstate); |
| 17 | |
| 18 | setTheme('base'); |
| 19 | |
| 20 | app.use(router); |
| 21 | app.use(pinia); |
| 22 | |
| 23 | app.component('HButton', HButton); |
| 24 | app.component('HCard', HCard); |
| 25 | app.component('HIcon', HIcon); |
| 26 | app.component('HSnackbar', HSnackbar); |
| 27 | app.component('HText', HText); |
| 28 | app.component('HToast', HToast); |
| 29 | |
| 30 | setDirectives(app); |
| 31 | |
| 32 | app.mount('#hostinger-reach-app'); |
| 33 | }; |
| 34 | |
| 35 | document.addEventListener('DOMContentLoaded', () => { |
| 36 | const targetElement = document.getElementById('hostinger-reach-app'); |
| 37 | |
| 38 | if (targetElement) { |
| 39 | initializeVueApp(); |
| 40 | } |
| 41 | }); |
| 42 |