这篇文章主要为大家详细介绍了vue组件实现进度条效果,具有一定的参考价值,可以用来参考一下。
感兴趣的小伙伴,下面一起跟随512笔记的小编两巴掌来看看吧!
本文实例为大家分享了vue实现进度条效果的具体代码,供大家参考,具体内容如下
一、效果图
【图片暂缺】
二、代码
progress-bar.vue
代码如下:
{{label}}
{{text}}
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;
}
}
}
.vue-progress-bar.default-theme{
.vue-progress-bar__outer {
background: #eee;
}
}
.vue-progress-bar {
.vue-progress-bar__tiptext {
float: right;
}
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持512笔记。
注:关于vue组件实现进度条效果的内容就先介绍到这里,更多相关文章的可以留意512笔记的其他信息。
关键词:vue.js