数据可视化大屏 页面都会有一个特色的小标题,用来放标题,今天整理 vue3 数据可视化大屏标题组件-海关信息中心。
效果描述
右上角有个圆点,高度48px 宽度自适应。
为了适配宽度,图片被分解为左中右三部分。
演示地址
组件代码
<template>
<div class="titleInfo">
<span>{{ title }}</span>
<div class="titleBg">
<div class="bg1"></div>
<div class="bg2"></div>
<div class="bg3"></div>
</div>
</div>
</template>
<script>
export default {
name: "title",
data() {
return {}
},
props: {
title: {
type: String,
default() {
return '数据大屏标题';
}
},
},
watch: {},
mounted() {
},
}
</script>
<style lang="scss" scoped>
.titleInfo {
width: calc(100% - 0px);
height: 48px;
display: flex;
position: relative;
justify-content: flex-start;
align-items: center;
flex-wrap: nowrap;
flex-direction: row;
align-content: flex-start;
span{
padding-left: 26px;
color: #cccccc;
font-size: 16px;
font-weight: 600;
}
.titleBg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 48px;
display: flex;
justify-content: flex-start;
align-items: center;
flex-wrap: nowrap;
flex-direction: row;
align-content: flex-start;
.bg1 {
background: url("./assets/titlebg1.png") no-repeat;
width: 30px;
height: 48px;
background-size: 100% 100%;
flex-shrink: 0;
}
.bg2 {
background: url("./assets/titlebg2.png") no-repeat;
width: 100%;
height: 48px;
background-size: 100% 100%;
}
.bg3 {
background: url("./assets/titlebg3.png") no-repeat;
width: 20px;
height: 48px;
flex-shrink: 0;
background-size: 100% 100%;
}
}
}
</style>