Progress add new prop: text-inside

This commit is contained in:
梁灏 2019-09-04 15:39:22 +08:00
parent ed83b3c088
commit d87a8854b1
3 changed files with 25 additions and 3 deletions

View file

@ -11,6 +11,10 @@
<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>
<Divider></Divider>
<Progress :percent="10" :stroke-width="20" text-inside></Progress>
</div> </div>
</template> </template>
<script> <script>

View file

@ -2,10 +2,10 @@
<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 && !textInside" :class="textClasses">
<slot> <slot>
<span v-if="isStatus" :class="textInnerClasses"> <span v-if="isStatus" :class="textInnerClasses">
<Icon :type="statusIcon"></Icon> <Icon :type="statusIcon"></Icon>
@ -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;