Progress add new prop: text-inside

Progress add new prop: text-inside
This commit is contained in:
mo.duan 2019-09-06 15:16:25 +08:00
parent 574a325c45
commit 61a07db243
3 changed files with 21 additions and 2 deletions

View file

@ -11,6 +11,7 @@
<Progress :percent="65" status="wrong"></Progress> <Progress :percent="65" status="wrong"></Progress>
<Progress :percent="100"></Progress> <Progress :percent="100"></Progress>
<Progress :percent="25" hide-info></Progress> <Progress :percent="25" hide-info></Progress>
<Progress :percent="10" :stroke-width="20" text-inside></Progress>
</div> </div>
</template> </template>
<script> <script>

View file

@ -2,7 +2,7 @@
<div :class="wrapClasses"> <div :class="wrapClasses">
<div :class="outerClasses"> <div :class="outerClasses">
<div :class="innerClasses"> <div :class="innerClasses">
<div :class="bgClasses" :style="bgStyle"></div><div :class="successBgClasses" :style="successBgStyle"></div> <div :class="bgClasses" :style="bgStyle"><div class="ivu-progress-inner-text" v-if="textInside">{{ percent }}%</div></div><div :class="successBgClasses" :style="successBgStyle"></div>
</div> </div>
</div> </div>
<span v-if="!hideInfo" :class="textClasses"> <span v-if="!hideInfo" :class="textClasses">
@ -55,6 +55,10 @@
}, },
strokeColor: { strokeColor: {
type: String type: String
},
textInside: {
type: Boolean,
default: false
} }
}, },
data () { data () {
@ -108,7 +112,7 @@
`${prefixCls}`, `${prefixCls}`,
`${prefixCls}-${this.currentStatus}`, `${prefixCls}-${this.currentStatus}`,
{ {
[`${prefixCls}-show-info`]: !this.hideInfo, [`${prefixCls}-show-info`]: !this.hideInfo && !this.textInside,
[`${prefixCls}-vertical`]: this.vertical [`${prefixCls}-vertical`]: this.vertical
} }

View file

@ -35,6 +35,13 @@
border-radius: 100px; border-radius: 100px;
vertical-align: middle; vertical-align: middle;
position: relative; position: relative;
&-text{
display: inline-block;
vertical-align: middle;
color: #fff;
font-size: 12px;
margin: 0 6px;
}
} }
&-vertical &-inner { &-vertical &-inner {
height: 100%; height: 100%;
@ -52,10 +59,17 @@
} }
&-bg { &-bg {
text-align: right;
border-radius: 100px; border-radius: 100px;
background-color: @primary-color; background-color: @primary-color;
transition: all @transition-time linear; transition: all @transition-time linear;
position: relative; position: relative;
&:after{
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
} }
&-success-bg{ &-success-bg{
border-radius: 100px; border-radius: 100px;