<!--
 * @Author: Rindy
 * @Date: 2020-03-13 16:53:05
 * @LastEditors: Rindy
 * @LastEditTime: 2020-09-07 16:25:41
 * @Description: 注释
 -->
<template>
    <div class="dev-system">
        <div class="container">
            <header>
                <span>系统设置</span>
                <span @click="onClose">
                    <i class="iconfont icon_close"></i>
                </span>
            </header>
            <article>
                <div class="menu">
                    <ul>
                        <li v-for="(item,key) in menu" :key="key" @click="onMenuClick(item)">{{item.text}}</li>
                    </ul>
                </div>
                <div class="page">
                    <component :is="component"></component>
                </div>
            </article>
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            menu: [{ text: "语言设置", name: "Lang" }, { text: '新闻设置', name: 'News'}],
            page: "Lang"
        };
    },
    computed: {
        component() {
            let page = this.page;
            return () => import(`@/components/dev/components/${page}.vue`);
        }
    },
    methods: {
        onClose() {
            document.body.removeChild(this.$el);
            this.$destroy();
            //this.$route.replace('/')
        },
        onMenuClick(item){
            this.page =item.name
        }
    }
};
</script>
<style lang="less" scoped>
.dev-system {
    padding: 20px;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    color: #000;
}
.container {
    display: flex;
    width: 100%;
    height: 100%;
    background-color: #efefef;
    flex-direction: column;
    overflow: hidden;
}
header {
    padding: 0 10px;
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: solid 1px #ccc;
    .icon_close {
        cursor: pointer;
    }
}
article {
    display: flex;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.menu {
    display: flex;
    width: 120px;
    height: 100%;
    border-right: solid 1px #ccc;
    ul {
        padding: 10px;
        li {
            cursor: pointer;
            margin-bottom: 10px;
        }
    }
}
.page {
    padding: 0 10px;
    display: flex;
    flex: 1;
    height: 100%;
}
</style>