DIV中左侧若显示,右侧自适应到最大宽度。
左侧不显示时,右侧自适应到100%
<template>
<div class="row">
<div class="card-left" v-show="isShow">
左侧固定内容
</div>
<div class="card-right">
右侧自适应
</div>
</div>
</template>
<script>
export default {
data(){
return{
isShow:true
}
},
mounted(){
this.getData();
},
methods:{
getData(){
//根据需要设置isShow
this.isShow=false;
}
}
}
</script>
<style scoped>
.row{display:flex;}
.card-left{float:left;margin-right:10px;height:230px;width:410px;}
.card-right{flex:1;}
</style>
原文:https://www.cnblogs.com/yzhihao/p/6513022.html 我从这里看到的,记录一下,以防忘记