subweb/src/layouts/Layout.vue

52 lines
1.2 KiB
Vue

<template>
<body :class="bodyClass">
<nav-bar-mobile />
<div id="page-wrapper">
<header-view />
<content-view />
<footer-view />
<dialog-lay-out />
</div>
</body>
</template>
<script>
import DialogLayOut from 'components/common/dialog/DialogLayOut.vue';
import NavBarMobile from './components/header/NavBarMobile';
import HeaderView from './HeaderView';
import ContentView from './ContentView';
import FooterView from './FooterView';
export default {
name: 'LayoutView',
components: {
NavBarMobile,
HeaderView,
ContentView,
FooterView,
DialogLayOut,
},
data() {
return {
screenWidth: document.body.clientWidth,
bodyClass: ['', ''],
};
},
created() {
this.emitter.on('isLanding', (isLanding) => {
this.bodyClass[0] = isLanding;
});
// 监听事件开关 NavBarMobile
this.emitter.on('isShowMobileNavBar', (isOutBodyTouch) => {
if (isOutBodyTouch == 'isOutBodyTouch') {
this.bodyClass[1] = '';
} else if (this.bodyClass[1] == '') {
this.bodyClass[1] = 'navPanel-visible';
} else {
this.bodyClass[1] = '';
}
});
},
};
</script>