2. 可视化大屏 - 自适应布局- 可直接使用

效果图:

总结:
弹性盒flex布局

display:flex 开启flex布局
flex:1 对应区块的占比大小
align-items 元素在交叉轴的对齐方式
justify-content 元素在x轴的排列方式
flex-wrap 是否允许元素换行 
flex:0 1 auto 

  • flex-grow:定义了项目的放大比例,默认为 0,即使存在剩余空间,也不放大。
  • flex-shrink:定义了项目的缩小比例,默认为 1,即如果空间不足,该项目将缩小。
  • flex-basis:定义在分配多余空间之前,项目占据的主轴空间

 html 代码:

<template>
	<div class="board-screen">
		<!-- 1. 头部 -->
		<div class="board-header"></div>
		
		<!-- 2. 全屏地图 -->
		<section class="map-container" v-loading="mapLoading" element-loading-text="地图加载中..." element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
			<div id="map-box" style="width: 100%; height: 100%"></div>
			<div class="map-list-bottom section-map-bottom" v-if="isFullShow">
			</div>
		</section>

		<!-- 3. 左侧 -->
		<div class="board-left" v-if="isFullShow">
			<div class="section-chart-left" style="flex: 0 1 20%;"></div>
			<div class="section-chart-left" style="flex: 0 1 38%"></div>
			<div class="section-chart-left" style="flex: 0 1 42%"></div>
		</div>

		<!-- 4.右侧 -->
		<div class="board-right" v-if="isFullShow">
			<div class="section-chart-right" style="flex: 0 1 30%"></div>
			<div class="section-chart-right" style="flex: 0 1 36%"></div>
			<div class="section-chart-right" style="flex: 0 1 34%"></div>
		</div>
	</div>
</template>

css代码:

<style lang="scss" scoped>
	.board-screen {
		width: 100vw;
		height: 100vh;
		overflow: hidden;
		position: relative;
		font-family: PingFangSC-Semibold, PingFang SC;

		// 1. 头部
		.board-header{
			position: absolute;
			width: 100%;
			height: 8%;
			top: 0;
			left: 0;
			z-index: 20;
			background: rgba(0, 0, 0,0.7)
		}
		
		// 2. 地图
		.map-container {
			position: absolute;
			height: calc(100vh);
			width: calc(100vw);
			top: 0;
			left: 0;
			.section-map-bottom {
				position: absolute;
				bottom: 0;
				left: 25%;
				width: 50%;
				height: 30%;
				background-color: rgba(0, 0, 0, 0.7);
			}
		}
		// 3/4 左侧 右侧
		.board-left, .board-right {
			position: absolute;
			width: 24%;
			height: calc(100vh - 8.6%);
			top: 8.6%;
			bottom: 0;
			display: flex;
			flex-direction: column;
		}
		.board-left {
			background-color: rgba(0, 0, 0, 0.7);
			left: 0;
		}
		.board-right {
			background-color: rgba(0, 0, 0, 0.7);
			right: 0;
		}
		
	}
</style>

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值