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