首页 > 其他 > 详细

vue Elemen-ui table 组件在使用flex布局后,表格宽度随页面变宽,但不能恢复的问题

时间:2021-04-12 18:10:24      阅读:31      评论:0      收藏:0      [点我收藏+]

背景: 左侧伸缩导航菜单,右侧的剩余部分为表格,左侧导航隐藏后再显示,表格会出现滚动条

<div class="flex">
    <aside style="width:100px">左侧导航</aside>
    <main class="flex1">
        <el-table>
        </el-table>
    </main>
</div>
<style>
    .flex{
        display: flex;
    }
    .flex1{
        flex:1;
    }
</style>

后修改为 定位

<div>
    <aside></aside>
    <main>
        <el-table>
        </el-table>
    </main>
</div>
<style>
    *{
        margin: 0;
        padding: 0;
    }
    html,body{
        height: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    div {
        position: relative;
        height: 100%;
        width: 100%;
    }
    aside {
        position: absolute;
        width: 100px;
        top: 0;
        bottom: 0;
        left: 0;
        background-color: aquamarine;
    }
    main {
        width: 100%;
        height: 100%;
        padding-left: 100px;
        box-sizing: border-box;
        background-color: aliceblue;
    }
</style>

 

 

vue Elemen-ui table 组件在使用flex布局后,表格宽度随页面变宽,但不能恢复的问题

原文:https://www.cnblogs.com/hill-foryou/p/14648827.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!