数据可视化大屏 页面都会有一个特色的小标题,用来放标题,今天整理 vue3 数据可视化大屏标题组件-数据资产。
效果描述
左侧图标 标题
底部分为三部分:左侧渐变色 右侧图片装饰,中间延伸底部.
可以作为数据边框组件的一部分:vue3 数据可视化大屏边框组件-数据资产
演示地址
组件代码
<template>
<div class="titleBg">
<div class="icon">
<img src="./assets/titleIcon.png" alt="">
</div>
<span>{{ title }}</span>
<div class="bgs">
<div class="bg1"></div>
<div class="bg2"></div>
<div class="bg3"></div>
</div>
</div>
</template>
<script>
<template>
<div class="titleBg">
<div class="icon">
<img src="./assets/titleIcon.png" alt="">
</div>
<span>{{ title }}</span>
<div class="bgs">
<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 '标题';
}
}
},
}
</script>
<style lang="scss" scoped>
.titleBg {
width: calc(100% - 0px);
display: flex;
height: 28px;
margin-bottom: 13px;
margin-top: 15px;
padding-top: 10px;
position: relative;
justify-content: flex-start;
align-items: center;
flex-wrap: nowrap;
flex-direction: row;
align-content: flex-start;
.icon {
img {
width: 18px;
}
}
span {
font-size: 22px;
font-family: YouSheBiaoTiHei;
font-weight: 400;
letter-spacing: 1px;
background: linear-gradient(88deg, #1BCFF2 0%, #1EFFFF 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin: 0;
padding: 0;
margin-top: -5px;
margin-left: 5px;
}
}
.bgs {
width: 100%;
display: flex;
justify-content: flex-start;
align-items: center;
flex-wrap: nowrap;
flex-direction: row;
align-content: flex-start;
position: absolute;
bottom: 0;
left: 0;
height: 27px;
.bg1 {
background: url("./assets/titlebg1.png") no-repeat;
background-size: 125px 100%;
width: 125px;
position: relative;
height: 100%;
}
.bg2 {
background: url("./assets/titlebg2.png") no-repeat;
background-size: 100% 100%;
width: calc(100% - 125px - 209px);
position: relative;
height: 100%;
}
.bg3 {
background: url("./assets/titlebg3.png") no-repeat;
background-size: 209px 100%;
width: 209px;
position: relative;
height: 100%;
}
}
</style>