<template>
<div class="common-layout">
<el-container>
<el-header>
<el-row class="el-row1">
<el-col :span="12">
<div class="grid-content ep-bg-purple">
<span style="color: white">当前用户span>
div>
<div>
<span style="color: white">新闻系统span>
div>
el-col>
<el-col :span="12">
<div class="grid-content ep-bg-purple-light">
<el-button @click="$router.push('/')">聊天室el-button>
<el-button @click="$router.push('/toybox/game')">猜数字游戏el-button>
div>
el-col>
el-row>
el-header>
<el-main>
<RouterView>RouterView>
el-main>
<el-footer>
el-footer>
el-container>
div>
template>
<style scoped>
.el-row1 {
background-color: black;
display: flex;
}
.grid-content {
border-radius: 4px;
min-height: 36px;
}
.common-layout {
display: flex;
justify-content: flex-start;
background-color: #2c3e50;
width: 100vw;
height: 100vh;
}
style>
在app组件中改一下#app的css
<style>
html,body,#app{
height:100%;
margin: 0;
padding: 0;
/*overflow-x: hidden;*/
}
style>
手动测试修改下
/*解决el-header左右占不满的问题*/
.el-header{
padding: 0;
}
这个common-layout很容易影响布局,导致我们后续自设的css不起作用,建议删除