-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprogressbar.vue
43 lines (41 loc) · 1.11 KB
/
progressbar.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<template>
<div class="vmc-progressbar">
<div class="bar-outer" :style="outerStyle">
<div class="bar-inner">
<div :style="innerStyle"></div>
</div>
</div>
<slot></slot>
</div>
</template>
<script type="es6">
import { getCSSSize } from '../../utils';
export default {
props: {
width: [Number, String],
value: [Number, String],
color: String,
backColor: String
},
computed: {
outerStyle() {
var style = {};
if (this.width) {
style.height = getCSSSize(this.width);
}
if (this.backColor) {
style.background = this.backColor;
}
return style;
},
innerStyle() {
var style = {};
style.width = (this.value || 0) + '%';
if (this.color) {
style.background = this.color;
}
return style;
}
}
}
</script>