边框由标题和主体两部分组成。背景采用背景色加角标定位,适应大部分宽高而不变形。
如果您需要设计属于自己的数据可视化大屏 请联系我们微信:17331886870
效果图
效果演示
组件代码
组件包含了三部分:标题 主体 背景。
主体部分放了一个插槽,通过插槽将其他组件插入到当前组件中。
组件使用
<item7 title="item7"></item7>
组件代码
<template>
<div class="pageItemBody">
<div class="titleInfo"><span>{{ title }}</span></div>
<div class="itemMain">
<slot></slot>
</div>
<bg></bg>
</div>
</template>
<script>
import bg from './bg.vue'
export default {
name: "title",
data() {
return {}
},
components: {
bg
},
props: {
title: {
type: String,
default() {
return '标题';
}
},
},
watch: {},
mounted() {
var that = this;
},
}
</script>
<style lang="scss" scoped>
.pageItemBody {
width: 100%;
position: relative;
height: 100%;
display: flex;
justify-content: flex-start;
align-items: flex-start;
flex-wrap: nowrap;
flex-direction: column;
z-index: 1;
align-content: flex-start;
.titleInfo {
font-size: 16px;
font-family: PingFang;
font-weight: bold;
color: #FFFFFF;
height: 63px;
width: 100%;
background: url("./assets/titlebg.png") no-repeat;
background-size: 420px 63px;
margin-top: 8px;
display: flex;
justify-content: flex-start;
align-items: center;
flex-wrap: nowrap;
flex-direction: row;
align-content: flex-start;
span {
font-size: 24px;
font-family: YouSheBiaoTiHei;
font-weight: 400;
color: #D6EEFF;
line-height: 30px;
text-shadow: 0px 3px 10px rgba(0, 0, 0, 0.26);
background: linear-gradient(0deg, #FFFFFF 0%, #CEE6FF 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
padding-left: 50px;
}
}
}
.itemMain {
position: relative;
width: 100%;
height: calc(100% - 71px);
}
</style>
背景组件
背景图因为有一些装饰的地方不能够无限拉伸宽高,为了能够在不同宽高的区域使用,这里做了类似九宫格的处理。
/**
* @Author: 858834013@qq.com
* @Name: pageItemBg
* @Date: 2023年05月13日11:39:14
* @Desc: 页面组件背景
*/
<template>
<div class="pageItemBg">
<img class="left_bottom" src="./assets/left_bottom.png" alt="">
<img class="right_top" src="./assets/right_top.png" alt="">
<img class="right_bottom" src="./assets/right_bottom.png" alt="">
</div>
</template>
<script>
export default {
name: "pageItemBg"
}
</script>
<style lang="scss" scoped>
.pageItemBg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
bottom: 0;
right: 0;
z-index: -1;
pointer-events: none; //避免div层被点击
background: linear-gradient(0deg, rgba(#04284C, 0.6) 0%, rgba(#02164E, 0.6) 100%);
.left_bottom {
position: absolute;
left: 0px;
bottom: 0px;
width: 98px;
height: 58px;
}
.right_top {
position: absolute;
right: 0px;
top: 0px;
width: 98px;
height: 98px;
}
.right_bottom {
position: absolute;
right: 0px;
bottom: 0px;
width: 117px;
height: 118px;
}
}
</style>