[bugfix] Progress: text empty (#1411)

This commit is contained in:
neverland 2018-07-05 19:24:00 +08:00 committed by GitHub
parent 3b8e446b50
commit 8942eb56fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
<template>
<div :class="b()">
<span :class="b('portion', { 'with-pivot': showPivot })" :style="portionStyle">
<span v-if="showPivot" ref="pivot" :style="pivotStyle" :class="b('pivot')">{{ pivotText }}</span>
<span :class="b('portion', { 'with-pivot': showPivot && text })" :style="portionStyle">
<span v-if="showPivot && text" ref="pivot" :style="pivotStyle" :class="b('pivot')">{{ text }}</span>
</span>
</div>
</template>
@ -14,6 +14,7 @@ export default create({
props: {
inactive: Boolean,
pivotText: String,
pivotColor: String,
percentage: {
type: Number,
@ -24,12 +25,6 @@ export default create({
type: Boolean,
default: true
},
pivotText: {
type: String,
default() {
return this.percentage + '%';
}
},
color: {
type: String,
default: '#38f'
@ -48,6 +43,12 @@ export default create({
},
computed: {
text() {
return this.isDef(this.pivotText)
? this.pivotText
: this.percentage + '%';
},
currentColor() {
return this.inactive ? '#cacaca' : this.color;
},