這期內容當中小編將會給大家帶來有關使用vue組件怎么實現一個進度條效果,文章內容豐富且以專業的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
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" :></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>上述就是小編為大家分享的使用vue組件怎么實現一個進度條效果了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關知識,歡迎關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。