<template>
    <div :style="menuPageCss" class="pages page-layout">
        <LayoutHeader v-if="menuPage!=='left'" @changePath="changePath"></LayoutHeader>
        <LayoutHeaderLeft @toggle="toggle" :isOpen="isOpen" v-if="menuPage==='left'" />
        <div style="padding:20px">
            <router-view :class="{'active': !isOpen}" />            
        </div>
    </div>
</template>
<script>
import LayoutHeader from "../components/Header";
import LayoutHeaderLeft from "../components/HeaderLeft";
import TabPane from '../components/tabPane.vue'
const isPC = /(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent);
//菜单位置：取值： left :菜单在左面， top :菜单在上面
const MenuPage = "top";

export default {
    components: {
        LayoutHeader,
        LayoutHeaderLeft,
        TabPane
    },
    data() {
        return {
            isOpen: isPC,
            menuPage: MenuPage,
            isfresh:true,
            path:''
        }
    },
    computed: {
        menuPageCss() {
            //左面和顶面菜单切换时，动态计划相关css参数
            return {
                "--padding-top": this.menuPage === "left" ? "60px" : "0px",
                "--margin-left": this.menuPage === "left" ? "200px" : "0px",
            }
        }
    },
    methods: {
        toggle() {
            this.isOpen = !this.isOpen;
        },
        changePath(e){
            this.path = e
        }
    },
};
</script>

<style lang="less">
.page {
    min-height: calc(100vh - 100px);
    width: 100%;
    position: relative;
    background: #fff;
    // var(--padding-top) 5px 5px 5px;
    padding: 20px;
    // margin-left: 60px;
    &.active {
        margin-left: var(--margin-left);
    }
}
.page-layout {
    background: #eee;
}
</style>


