diff --git a/resources/js/app.js b/resources/js/app.js index 921dbcd3..704d5e8b 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,5 +1,6 @@ import Vue from 'vue'; import {App as InertiaApp, plugin, Link as ILink} from '@inertiajs/inertia-vue'; +import {Inertia} from '@inertiajs/inertia'; import SvgSprite from './components/SvgSprite.js'; import VPages from './components/VPages.vue'; @@ -32,6 +33,8 @@ const el = document.getElementById('app'); Vue.mixin(hasModule); Vue.component('ILink', ILink); +Inertia.on('start', (event) => window.dispatchEvent(new Event('inertiaStart'))); + new Vue({ render: (h) => h(InertiaApp, { diff --git a/resources/js/layouts/AppLayout.vue b/resources/js/layouts/AppLayout.vue index dfcd5a44..a6ec8da5 100644 --- a/resources/js/layouts/AppLayout.vue +++ b/resources/js/layouts/AppLayout.vue @@ -150,8 +150,15 @@ export default { }, }, created() { + var _self = this; window.addEventListener('resize', this.menuListener); this.menuListener(); + + window.addEventListener('inertiaStart', (e) => { + _self.menuVisible = false; + _self.searchVisible = false; + _self.menuOverflowVisible = false; + }); }, };