文章目录
- 一、效果图
- 二、使用步骤
- 1.公共的进度条组件
- 2.使用
- 总结
一、效果图
二、使用步骤
1.公共的进度条组件
我这里命名的progressBar.vue, 你们使用的时候直接复制粘贴到自己的项目里面即可。
文件中代码如下(示例):
<template>
<div>
<div style="width: 100%;height: 100%">
<div v-for="(item, index) in showList" :key="index + item.value" class="item">
<div :class="index < 3 && page == 1 ? ('itemIcon' + (index + 1)) : 'itemIcon'">{{ index + 1 }}</div>
<div class="itemTitle">{{ item.name }}</div>
<div class="itemValue">{{ item.value }}{{unit}}</div>
<div class="itemBar">
<div :class="index < 2 && page == 1 ? ('innerBar' + (index + 1)) : 'innerBar'" :style="'width:' + (item.value / maxValue * 100).toFixed(2) + '%;'"></div>
</div>
</div>
<div class="pager-content">
<div v-for="pageNum in totalPage" :class="pageNum == page ? 'selected' : ''" @click="page = pageNum"></div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "progressBar",
props: {
dataList:{
type: Array,
default:[
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
],
},
unit:{
type: String,
default:'%',
}
},
data () {
return {
page: 1,
limit: 7,
}
},
computed: {
showList () {
return this.dataList.slice(((this.page - 1) * this.limit), (this.page * this.limit))
},
totalPage () {
const length = this.dataList.length
let value = Math.floor(length / this.limit)
if (length % this.limit !== 0) value++
return value
},
maxValue(){
let maxNum = 0
let list = this.dataList.map(i => i.value)
maxNum = Math.max(...list)
return maxNum
}
},
}
</script>
<style scoped lang="less">
.item{
position: relative;
margin-top: 30px;
width: 100%;
height: 45px;
.itemIcon1{
position: absolute;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAsCAYAAAATmipGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1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
font-weight: normal;
font-stretch: normal;
line-height: 44px;
letter-spacing: 0px;
color: #ffffff;
text-align: center;
}
.itemIcon2{
position: absolute;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAsCAYAAAATmipGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDAyIDc5LjE2NDQ2MCwgMjAyMC8wNS8xMi0xNjowNDoxNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjIgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjI0MjlBNzgxM0NGMjExRUY5MTUwRUQzNDk5OUY3QjQyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjI0MjlBNzgyM0NGMjExRUY5MTUwRUQzNDk5OUY3QjQyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6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/eWV934F1uFq7pz21tZNmeh4wO5flnpZImpGYEbPTRX9PccmiTf6ihYekMiSrmyKlFJlQ3HVk+Gp5zIHrB/9c0fzr76dJq7VoSpWH45woXLVgc/mmG37SFHYtTdmsrUJ1ki1MqEgpLVV/3nVvODy8lmX3g10RWlbgzR78qPfWlZ9Yvl9TSuWmshih1vVUtwCBNKsknm4RgpnBjOqOnWui02MPQlpK6KvjSt+23pU3v+vOmT0ioNTVErVExmocRcrSODKVJZpVEz/bNo/8M298z951uDZ+R4cQfX9/6drFb/Vct/SQpNpmznKObsFMC9rNSp4KnEnbrf7y242Nw0c2sDDUV5g/980Zd92+TUCE0kKZvHwTGQAnTKHI8LOhm7VRV+lJ9ciSZAcHdZepuyFeHklQkWKH2DC/Twi2lsmuRt7bSpW5P5ak05JsjYeWcda5g9SYV59jkKeyY3FdDj8tA6z8zomS6/L3jWn93pbs2FIWDUCSFtZIcMLS4sX42UCVlyNJ2paQdN7PBmrKii7mzwbTfyMZFmkckRoS4UkBTuc/k26dHWnMhHb5c+yS/rnTAV8IcFrtfwEGAEMMQNmZ/UzaAAAAAElFTkSuQmCC");
width: 42px;
height: 44px;
font-family: DINPro-Bold;
font-size: 16px;
font-weight: normal;
font-stretch: normal;
line-height: 44px;
letter-spacing: 0px;
color: #ffffff;
text-align: center;
}
.itemIcon3{
position: absolute;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAsCAYAAAATmipGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDAyIDc5LjE2NDQ2MCwgMjAyMC8wNS8xMi0xN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2rOVoq8i5tvIW16WU6nhh09bVuBxrU6wvM4KeKbJntmtuhp9vbOv3rmLHjtbV6rC6BtuWFo/GxwY9KjBNy/E0HxuEzZuP5scG23cjFZYZHFFYCuFZAc7nO5NpnZ0ZzETM8OPY//rlzgQ8HeC8tn8FGABV5R4U7Uz3YAAAAABJRU5ErkJggg==");
width: 42px;
height: 44px;
font-family: DINPro-Bold;
font-size: 16px;
font-weight: normal;
font-stretch: normal;
line-height: 44px;
letter-spacing: 0px;
color: #ffffff;
text-align: center;
}
.itemIcon{
position: absolute;
width: 42px;
height: 44px;
font-family: DINPro-Bold;
font-size: 16px;
font-weight: normal;
font-stretch: normal;
line-height: 44px;
letter-spacing: 0px;
color: #ffffff;
text-align: center;
visibility: hidden;
}
.itemTitle{
position: absolute;
left: 50px;
font-family: SourceHanSansCN-Regular;
font-size: 16px;
font-weight: normal;
font-stretch: normal;
//line-height: 47px;
letter-spacing: 0px;
color: #7fbfff;
}
.itemValue{
position: absolute;
right: 20px;
font-family: SourceHanSansCN-Regular;
font-size: 16px;
font-weight: normal;
font-stretch: normal;
//line-height: 47px;
letter-spacing: 0px;
color: #ffffff;
}
.itemBar{
position: absolute;
left: 50px;
top: 25px;
width: calc(100% - 70px);
height: 20px;
background-color: #031632;
border-radius: 9px;
border: solid 1px #0234a7;
.innerBar1{
position: relative;
margin-left: 2px;
margin-top: 2px;
height: 14px;
background-image: linear-gradient(180deg,
#ffe62c 0%,
#ffa202 100%),
linear-gradient(
#eeeeee,
#eeeeee);
background-blend-mode: normal,
normal;
border-radius: 7px;
border: solid 1px #03297f;
animation: lToR 2s;
-moz-animation: lToR 2s;
-webkit-animation: lToR 2s;
-o-animation: lToR 2s;
}
.innerBar2{
position: relative;
margin-left: 2px;
margin-top: 2px;
height: 14px;
background-image: linear-gradient(180deg,
#2be9b6 0%,
#049b68 100%),
linear-gradient(
#eeeeee,
#eeeeee);
background-blend-mode: normal,
normal;
border-radius: 7px;
border: solid 1px #03297f;
animation: lToR 2s;
-moz-animation: lToR 2s;
-webkit-animation: lToR 2s;
-o-animation: lToR 2s;
}
.innerBar{
position: relative;
margin-left: 2px;
margin-top: 2px;
height: 14px;
background-image: linear-gradient(180deg,
#2cd0ff 0%,
#0084ff 100%),
linear-gradient(
#eeeeee,
#eeeeee);
background-blend-mode: normal,
normal;
border-radius: 7px;
border: solid 1px #03297f;
animation: lToR 2s;
-moz-animation: lToR 2s;
-webkit-animation: lToR 2s;
-o-animation: lToR 2s;
}
}
}
.pager-content{
position: absolute;
bottom: 30px;
height: 20px;
display: flex;
justify-content: space-evenly;
flex-flow: row nowrap;
background: rgba(0,0,0,0.3);
padding-top: 4px;
border-radius: 10px;
width: 85%;
width: 250px;
left: calc(50% - 125px);
}
.pager-content>div{
width: 12px;
height: 12px;
cursor: pointer;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTMyIDc5LjE1OTI4NCwgMjAxNi8wNC8xOS0xMzoxMzo0MCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9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XDTxgiYWgYS1baDWttvu+s3ut1oJiL7ky7ydN/PtzLyZZ+YepnJiuYAH+ISlfggMiBgYjTvZsb1DxwCYBmYpA553gTbwjbJL0mScSEkmgEvAArAE3AKuk0zovAvsAJ+APep6SlYQ+SRRggoSq168J7XlipRXFkUuGDCA4sO2RF82ZSONpQ67beAz0FQyy5oEjKSSzMqD4Ims374psgr6ZVRrBvHeWBG5siTlrYo8+vhc5tIoC6DPiGKHhZ3RaFJE0n0s6yUkVEIUUyYnCW0us+8QET6V+6kvVWagvl5R4Mtak0FVaqN50OMi+0AHaKGUjWEuO9Qn11Dlu1JjHdXXtyTSgobxmpQ1XnWIcLm7w7yAGonq9Fv1ulfb0hsJ6ZsR2eLKRwu54zH+vs8uaSd5mn2Sq17PZT47LtrDWjljHcKhl+bSM3m6GklGgmWSP+0tOzZrNvcr2nXx96E6HZ/xI+fgV2+p79Bhd6qi4b2XSP5x0bZB30FBpE2147+VDXf/fBK1UVt2ebMg0gFsadubgdSDF7Lp7v2dRG3UlqOiEcXu1J1nOv4pa9UzP6TtvZMjGF5NJ3EjmEAzyglKdYkmX8orpyOvOSKa2pESGT4jxdBO82KLoQ1PDG3jvKFNqGhyflocyNOekSbl99OekXGymEaH//Ow/RRgAFR62RXAIZxlAAAAAElFTkSuQmCC") no-repeat center center !important;
}
@keyframes lToR
{
from {width: 0px;}
}
@-moz-keyframes lToR /* Firefox */
{
from {width: 0px;}
}
@-webkit-keyframes lToR /* Safari and Chrome */
{
from {width: 0px;}
}
@-o-keyframes lToR /* Opera */
{
from {width: 0px;}
}
</style>
2.使用
在另外一个文件中要使用进度条组件,代码如下(示例):
<template>
<div class="part3_2">
<progressBar class="part_content" :dataList="dataList" :unit="'%'"></progressBar>
</div>
</template>
<script>
import progressBar from "../../../components/progressBar.vue";
export default {
name: 'part3_2', // vue名称
components:{progressBar},
data () {
return {
dataList: [],
}
},
mounted() {
this.init()
},
methods: {
//初始值
async init(){
this.dataList = [
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), },
{ name: '旅游行业', value: (Math.random() * 100).toFixed(1), }
]
this.dataList.sort((a,b) => {
return b.value - a.value
})
},
}
}
</script>
<style scoped lang="less">
.part3_2{
position: absolute;
top: 230px;
left: 60px;
width: 31%;
height: calc(100% - 250px);
.part_content {
position: absolute;
top: 30px;
width: 100%;
height: calc(100% - 30px);
overflow: auto;
}
}
</style>
总结
以上就是我今天分享的内容,觉得有用的读者可以动动小手点一个小赞。