primevue-mirror/apps/showcase/layouts/default.vue

92 lines
2.4 KiB
Vue
Raw Normal View History

2022-09-06 11:52:18 +00:00
<template>
2024-03-28 14:11:57 +00:00
<div :class="containerClass" :data-p-theme="$appState.theme">
2023-10-17 11:34:50 +00:00
<AppNews />
2024-02-07 12:14:37 +00:00
<AppTopBar @menubutton-click="onMenuButtonClick" />
2022-09-14 14:26:41 +00:00
<div :class="['layout-mask', { 'layout-mask-active': sidebarActive }]" @click="onMaskClick"></div>
<div class="layout-content">
2023-10-07 15:46:59 +00:00
<app-menu :active="sidebarActive" />
<div class="layout-content-slot">
2022-09-14 14:26:41 +00:00
<slot></slot>
</div>
</div>
2024-11-10 15:24:15 +00:00
<AppDesigner />
2023-10-10 08:38:49 +00:00
<AppFooter />
2022-09-14 14:26:41 +00:00
<Toast />
<Toast position="top-left" group="tl" />
<Toast position="bottom-left" group="bl" />
<Toast position="bottom-right" group="br" />
</div>
2022-09-06 11:52:18 +00:00
</template>
<script>
import { blockBodyScroll, unblockBodyScroll } from '@primeuix/utils/dom';
2022-12-09 09:02:20 +00:00
import AppFooter from './AppFooter.vue';
import AppMenu from './AppMenu.vue';
2022-09-06 11:52:18 +00:00
import AppNews from './AppNews.vue';
2024-11-10 15:24:15 +00:00
import AppDesigner from './AppDesigner.vue';
2022-12-09 09:02:20 +00:00
import AppTopBar from './AppTopBar.vue';
2022-09-06 11:52:18 +00:00
export default {
2022-09-14 14:26:41 +00:00
data() {
return {
2024-02-07 10:15:47 +00:00
sidebarActive: false
2022-09-14 14:26:41 +00:00
};
},
2022-12-19 12:44:12 +00:00
watch: {
$route: {
immediate: true,
2024-02-07 10:15:47 +00:00
handler() {
2022-12-19 12:44:12 +00:00
if (!process.client || typeof window === 'undefined') {
return;
}
2022-09-06 11:52:18 +00:00
2022-12-19 12:44:12 +00:00
this.sidebarActive = false;
unblockBodyScroll('blocked-scroll');
2022-12-19 12:44:12 +00:00
this.$toast.removeAllGroups();
}
}
},
2022-09-14 14:26:41 +00:00
methods: {
onMenuButtonClick() {
if (this.sidebarActive) {
this.sidebarActive = false;
unblockBodyScroll('blocked-scroll');
2022-09-14 14:26:41 +00:00
} else {
this.sidebarActive = true;
blockBodyScroll('blocked-scroll');
2022-09-14 14:26:41 +00:00
}
},
onMaskClick() {
this.sidebarActive = false;
unblockBodyScroll('blocked-scroll');
2022-09-14 14:26:41 +00:00
},
isOutdatedIE() {
let ua = window.navigator.userAgent;
2022-12-20 12:32:32 +00:00
2022-09-14 14:26:41 +00:00
if (ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0) {
return true;
}
2022-09-06 11:52:18 +00:00
2022-09-14 14:26:41 +00:00
return false;
}
},
computed: {
containerClass() {
return [
2024-03-28 14:11:57 +00:00
'layout-wrapper',
2022-09-14 14:26:41 +00:00
{
'layout-news-active': this.$appState.newsActive
2022-09-14 14:26:41 +00:00
}
];
}
},
components: {
2023-10-10 08:38:49 +00:00
AppTopBar,
AppMenu,
AppFooter,
2024-11-10 15:24:15 +00:00
AppNews,
AppDesigner
2022-09-14 14:26:41 +00:00
}
};
2022-09-06 11:52:18 +00:00
</script>