whychdw
2021-03-02 f948c42a5a71b0bfbbc901f439d41f723a26dc07
容器组件
1个文件已修改
1个文件已添加
150 ■■■■■ 已修改文件
src/components/LayoutBox.vue 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayoutBox.vue
New file
@@ -0,0 +1,133 @@
<template>
  <div class="layout-box-container">
    <div class="layout-box-wrapper">
      <div class="layout-box-radius tl"></div>
      <div class="layout-box-radius tr"></div>
      <div class="layout-box-radius bl"></div>
      <div class="layout-box-radius br"></div>
      <div class="layout-box-header">
        <div class="layout-rect left"></div>
        <div class="header-text-wrapper">
          <div class="header-text">{{title}}</div>
        </div>
        <div class="layout-rect right"></div>
      </div>
      <div class="layout-box-body">
        <slot></slot>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "LayoutBox",
  props: {
    title: {
      type: String,
      default: "无"
    }
  },
  data() {
    return {}
  }
}
</script>
<style scoped>
.layout-box-container {
  height: 100%;
  box-sizing: border-box;
  padding-top: 22px;
}
.layout-box-wrapper {
  position: relative;
  box-sizing: border-box;
  height: 100%;
  background-color: #021651;
  border-radius: 12px;
  border: 1px solid #073980;
}
.layout-box-radius {
  position: absolute;
  width: 22px;
  height: 22px;
}
.layout-box-radius.tl {
  top: -1px;
  left: -1px;
  border-top: 2px solid #00B2E0;
  border-left: 2px solid #00B2E0;
  border-top-left-radius: 11px;
}
.layout-box-radius.tr {
  top: -1px;
  right: -1px;
  border-top: 2px solid #00B2E0;
  border-right: 2px solid #00B2E0;
  border-top-right-radius: 11px;
}
.layout-box-radius.br {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid #00B2E0;
  border-right: 2px solid #00B2E0;
  border-bottom-right-radius: 11px;
}
.layout-box-radius.bl {
  bottom: -1px;
  left: -1px;
  border-bottom: 2px solid #00B2E0;
  border-left: 2px solid #00B2E0;
  border-bottom-left-radius: 11px;
}
.layout-box-header {
  position: absolute;
  left: 0;
  right: 0;
  top: -22px;
  width: 100%;
  text-align: center;
}
.layout-rect {
  display: inline-block;
  width: 60px;
  height: 4px;
  background-color: #00B2E0;
}
.layout-rect.left {
  margin-right: 16px;
}
.layout-rect.right {
  margin-left: 16px;
}
.header-text-wrapper {
  position: relative;
  display: inline-block;
  font-size: 18px;
  font-weight: bold;
  padding: 4px 24px;
  z-index: 1;
}
.header-text {
  position: relative;
  z-index: 1;
}
.header-text-wrapper:after {
  position: absolute;
  display: block;
  content: " ";
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: skew(15deg);
  background-color: #083880;
  z-index: 0;
}
.layout-box-body {
  padding: 16px 4px 4px 4px;
  box-sizing: border-box;
  height: 100%;
}
</style>
src/pages/test.vue
@@ -4,19 +4,19 @@
<!--      <circle-chart id="circleTest" ref="circleTest"></circle-chart>-->
<!--    </div>-->
    <div class="test-wrapper mg8">
      <div class></div>
      <div class="layout-box-wrapper">
        <div class="layout-box-header">单体容量</div>
      </div>
      <layout-box title="在线电压和组端电压">
      </layout-box>
    </div>
  </div>
</template>
<script>
import LayoutBox from "@/components/LayoutBox";
export default {
  name: "Test",
  components: {},
  components: {LayoutBox},
  data() {
    return {}
  },
@@ -31,12 +31,5 @@
}
.mg8 {
  margin: 8px;
}
.layout-box-wrapper {
  position: relative;
  height: 100%;
  background-color: #021651;
  border-radius: 12px;
  border: 1px solid #073980;
}
</style>