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

二、代碼
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>
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
Vue3中使用reactive時,后端有返回數(shù)據(jù)但dom沒有更新的解決
這篇文章主要介紹了Vue3中使用reactive時,后端有返回數(shù)據(jù)但dom沒有更新的解決,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-03-03
el-table實現(xiàn)嵌套表格的展示功能(完整代碼)
el-table中在嵌套一個el-table,這樣數(shù)據(jù)格式就沒問題了,主要就是樣式,將共同的列放到一列中,通過渲染自定義表頭render-header,將表頭按照合適的寬度渲染出來,本文給大家分享el-table實現(xiàn)嵌套表格的展示功能,感興趣的朋友一起看看吧2024-02-02
Vue路由對象屬性 .meta $route.matched詳解
今天小編就為大家分享一篇Vue路由對象屬性 .meta $route.matched詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-11-11

