adrema/resources/js/app.js

63 lines
2.2 KiB
JavaScript
Raw Normal View History

2020-04-10 20:32:12 +02:00
import Vue from 'vue';
2022-11-17 20:56:46 +01:00
import {App as InertiaApp, plugin, Link as ILink} from '@inertiajs/inertia-vue';
2022-12-05 00:04:01 +01:00
import {Inertia} from '@inertiajs/inertia';
2020-04-10 20:32:12 +02:00
2022-02-12 15:22:22 +01:00
import SvgSprite from './components/SvgSprite.js';
2022-02-12 15:12:08 +01:00
import VPages from './components/VPages.vue';
2022-11-24 00:59:40 +01:00
import VLabel from './components/VLabel.vue';
2021-04-11 02:55:26 +02:00
import VBool from './components/VBool.vue';
2022-12-02 00:42:06 +01:00
import Box from './components/Box.vue';
import Heading from './components/Heading.vue';
2023-03-04 12:02:17 +01:00
import IconButton from './components/Ui/IconButton.vue';
2022-02-12 15:04:52 +01:00
import AppLayout from './layouts/AppLayout.vue';
2022-02-12 01:31:01 +01:00
import VTooltip from 'v-tooltip';
import hasModule from './mixins/hasModule.js';
2023-03-04 12:02:17 +01:00
import hasFlash from './mixins/hasFlash.js';
2022-12-04 23:40:35 +01:00
import PortalVue from 'portal-vue';
2023-02-26 20:51:59 +01:00
import axios from 'axios';
import VueAxios from 'vue-axios';
2023-03-04 12:02:17 +01:00
import Toasted from 'vue-toasted';
2020-04-10 20:32:12 +02:00
2022-02-12 01:31:01 +01:00
Vue.use(plugin);
2022-12-04 23:40:35 +01:00
Vue.use(PortalVue);
2021-08-22 16:49:38 +02:00
Vue.use(VTooltip);
2023-03-04 12:02:17 +01:00
Vue.use(Toasted);
2023-02-26 20:51:59 +01:00
Vue.use(VueAxios, axios);
2022-12-04 23:40:35 +01:00
Vue.component('f-text', () => import(/* webpackChunkName: "form" */ './components/FText'));
Vue.component('f-switch', () => import(/* webpackChunkName: "form" */ './components/FSwitch'));
Vue.component('f-select', () => import(/* webpackChunkName: "form" */ './components/FSelect'));
Vue.component('f-textarea', () => import(/* webpackChunkName: "form" */ './components/FTextarea'));
2022-02-12 15:22:22 +01:00
Vue.component('SvgSprite', SvgSprite);
2022-02-12 15:12:08 +01:00
Vue.component('VPages', VPages);
2021-04-11 02:55:26 +02:00
Vue.component('v-bool', VBool);
2022-11-24 00:59:40 +01:00
Vue.component('v-label', VLabel);
2022-12-02 00:42:06 +01:00
Vue.component('box', Box);
Vue.component('heading', Heading);
2023-03-04 12:02:17 +01:00
Vue.component('icon-button', IconButton);
2022-12-04 23:40:35 +01:00
Vue.component('save-button', () => import(/* webpackChunkName: "form" */ './components/SaveButton'));
2020-04-10 20:32:12 +02:00
2022-02-12 01:31:01 +01:00
const el = document.getElementById('app');
2020-04-12 00:26:44 +02:00
Vue.mixin(hasModule);
2023-03-04 12:02:17 +01:00
Vue.mixin(hasFlash);
2022-02-12 15:26:14 +01:00
Vue.component('ILink', ILink);
2022-12-05 00:04:01 +01:00
Inertia.on('start', (event) => window.dispatchEvent(new Event('inertiaStart')));
2020-04-10 20:32:12 +02:00
new Vue({
2022-11-17 20:56:46 +01:00
render: (h) =>
h(InertiaApp, {
props: {
initialPage: JSON.parse(el.dataset.page),
resolveComponent: async (name) => {
var page = (await import(`./views/${name}`)).default;
2021-04-11 11:19:55 +02:00
2022-11-17 20:56:46 +01:00
if (page.layout === undefined) {
page.layout = AppLayout;
}
return page;
},
},
}),
2021-04-10 19:45:11 +02:00
}).$mount(el);