vue組件實現(xiàn)進度條效果
更新時間:2018年06月06日 11:14:42 作者:wl_
這篇文章主要為大家詳細介紹了vue組件實現(xiàn)進度條效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了vue實現(xiàn)進度條效果的具體代碼,供大家參考,具體內(nèi)容如下
一、效果圖

二、代碼
progress-bar.vue
<template>
<div class="vue-progress-bar default-theme">
<div class="vue-progress-bar__tip">
<span class="vue-progress-bar__tiplabel">{{label}}</span>
<span class="vue-progress-bar__tiptext">{{text}}</span>
</div>
<div class="vue-progress-bar__outer">
<div class="vue-progress-bar__inner" :style="barStyle"></div>
</div>
</div>
</template>
<script>
export default {
props:{
label:String,
text:String,
height:{
type: Number,
default: 0,
required: true,
validator: val => val >= 0
},
color: {
type: String,
default: ''
},
percentage:{
type: Number,
default: 0,
required: true,
validator: val => val >= 0 && val <= 100
}
},
computed:{
barStyle() {
const style = {};
style.width = this.percentage + '%';
style.height = this.height + 'px';
style.backgroundColor = this.color;
return style;
}
}
}
</script>
<style lang="scss" scoped>
.vue-progress-bar.default-theme{
.vue-progress-bar__outer {
background: #eee;
}
}
.vue-progress-bar {
.vue-progress-bar__tiptext {
float: right;
}
}
</style>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
vue2和elementUI?實現(xiàn)落日余暉登錄頁和滑塊校驗功能
這篇文章主要介紹了vue2和elementUI打造落日余暉登錄頁和滑塊校驗,本文通過實例代碼給大家介紹的非常詳細,需要的朋友可以參考下2023-06-06
vue模塊導(dǎo)入報錯問題Module not found: Error:[CaseSensi
這篇文章主要介紹了vue模塊導(dǎo)入報錯問題Module not found: Error:[CaseSensitivePathsPlugin],具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-06-06
Vue3中關(guān)于getCurrentInstance的大坑及解決
這篇文章主要介紹了Vue3中關(guān)于getCurrentInstance的大坑及解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-04-04
詳解vuex中的this.$store.dispatch方法
這篇文章主要介紹了vuex中的this.$store.dispatch方法,必須要用commit(‘SET_TOKEN’,?tokenV)調(diào)用mutations里的方法,才能在store存儲成功,需要的朋友可以參考下2022-11-11
vue3封裝echarts圖表數(shù)據(jù)無法渲染到頁面問題
這篇文章主要介紹了vue3封裝echarts圖表數(shù)據(jù)無法渲染到頁面問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-09-09

