自适应大屏 flex百分比布局-2倍屏

 

<template>
  <div class="screen-large" id="screenLarge">
    <div class="screen-large_wrap" id="screenLargeWrap">
    <div class="title">
      <div class="title_center">
        <img src="~@/assets/img/largeScreen/title_icon.png" alt="" />
        有限湛江分公司智能运维平台
      </div>
    </div>
    <div class="box">
      <div class="box_left">
        <div class="box_left_top">
          <div class="one">
            <div class="one_title">
              <div class="name">标题</div>
            </div>
            <div class="one_content"></div>
          </div>
        </div>
        <div class="box_left_center">
          <div class="one">
            <div class="one_title">
              <div class="name">标题</div>
            </div>
            <div class="one_content"></div>
          </div>
        </div>
        <div class="box_left_bottom">
          <div class="one one_last">
            <div class="one_title">
              <div class="name">标题</div>
            </div>
            <div class="one_content"></div>
          </div>
        </div>
      </div>
      <div class="box_right">
        <div class="box_right_top">
          <div class="one">
            <div class="one_title">
              <div class="name">标题</div>
            </div>
            <div class="one_content"></div>
          </div>
        </div>
        <div class="box_right_center">
          <div class="box_right_center_left">
            <div class="one">
              <div class="one_title">
                <div class="name">标题</div>
              </div>
              <div class="one_content"></div>
            </div>
          </div>
          <div class="box_right_center_right">
            <div class="one">
              <div class="one_title">
                <div class="name">标题</div>
              </div>
              <div class="one_content"></div>
            </div>
          </div>
        </div>
        <div class="box_right_bottom">
          <div class="box_right_bottom_left">
            <div class="one">
              <div class="one_title">
                <div class="name">标题</div>
              </div>
              <div class="one_content"></div>
            </div>
          </div>
          <div class="box_right_bottom_right">
            <div class="one">
              <div class="one_title">
                <div class="name">标题</div>
              </div>
              <div class="one_content"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</template>

<script>
export default {
  name: "largeScreen",
  data() {
    return {};
  },
  created() {},
  mounted() {
    this.changeWin();
    //调整窗口大小
    window.onresize = () => {
      const self = this;
      return (() => {
        self.changeWin();
      })();
    };
  },
  methods: {
    //屏幕适配
    changeWin() {
      this.$nextTick(() => {
        let w = document.getElementById("screenLarge").offsetWidth;
        let h = document.getElementById("screenLarge").offsetHeight;
        const pw = w / 3840;
        const ph = h / 2160;
        document.getElementById("screenLargeWrap").style.transform =
          "scale(" + pw + "," + ph + ")";
        document.getElementById("screenLargeWrap").style.transformOrigin = "top left 0";
      });
    },
  },
  computed: {},
};
</script>
<style lang="scss" scoped>
.screen-large {
  width: 100%;
  height: 100%;
}
.screen-large_wrap {
  width: 3840px;
  height: 2160px;
  background-color: #02132a;
  color: #fff;
}
.title {
  width: 100%;
  height: 86px;
  background-image: url("~@/assets/img/largeScreen/title_bj.png");
  background-size: 100% 100%;
  position: relative;
  .title_center {
    text-align: center;
    font-size: 24px;
    line-height: 86px;
    display: flex;
    align-items: center;
    justify-content: center;

    img {
      width: 53px;
      height: 53px;
      margin-right: 5px;
    }
  }
}

.one {
  width: 100%;
  height: 100%;
  background-image: linear-gradient(180deg, #00509500 0%, #022659b3 100%);
  border-right: 2px solid;
  border-left: 2px solid;
  border-image: linear-gradient(
      180deg,
      rgb(2 19 42) 5%,
      rgb(38 69 97) 53%,
      rgb(93 173 254) 80%
    )
    2 2 2 2;
  border-bottom: 2px rgb(93 173 254) solid;
  .one_title {
    width: 100%;
    height: 63px;
    line-height: 63px;
    background-image: url("~@/assets/img/largeScreen/icon_group.png");
    background-size: 564px 63px;
    background-repeat: no-repeat;
    .name {
      font-size: 23px;
      margin-left: 63px;
    }
  }
  .one_content {
    width: 100%;
    height: calc(100% - 65px);
    padding: 34px 24px 34px 24px;
  }
}
.w100 {
  width: 100% !important;
}

.box {
  display: flex;
  height: calc(100% - 86px);
  width: 100%;
  padding: 0 16px 16px 16px;
  box-sizing: border-box;

  .box_left {
    width: calc(33% - 16px);
    height: 100%;
    margin-right: 16px;
    .box_left_top {
      width: 100%;
      height: 33%;
    }
    .box_left_center {
      width: 100%;
      height: 33%;
    }
    .box_left_bottom {
      width: 100%;
      height: 34%;
    }
  }
  .box_right {
    width: 67%;
    height: 100%;
    .box_right_top {
      width: 100%;
      height: 33%;
    }
    .box_right_center {
      width: 100%;
      height: 33%;
      display: flex;
      .box_right_center_left {
        width: calc(50% - 16px);
        margin-right: 16px;
      }
      .box_right_center_right {
        width: 50%;
      }
    }
    .box_right_bottom {
      width: 100%;
      height: 34%;
      display: flex;
      .box_right_bottom_left {
        width: calc(50% - 16px);
        margin-right: 16px;
      }
      .box_right_bottom_right {
        width: 50%;
      }
    }
  }
}
</style>

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值