Newer
Older
CloudBrainNew / src / components / progressBar / Progress.vue
StephanieGitHub on 4 Feb 2021 1 KB first commit

<template>
  <div class="progress-box">
    <div class="progressbar" style="wdith: 100%; display: flex; justify-content: space-between">
      <div class="progress-bar">
        <div class="progress-bar__outer">
          <div class="progress-bar__inner" :style="`width:${percentage}%; background:${color};`"></div>
        </div>
      </div>
      <div class="progress__text">{{num}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name:'progress',
  props: {
    percentage: String | Number, // 百分比
    num: String | Number, // 后面的文字数量
    color: String // 颜色
  },
  methods: {

  }
}
</script>

<style scoped>
.progressbar{
  width: 100%;
  line-height: .5;
}
.progress-bar{
  padding-right: .13rem;
  display: inline-block;
  vertical-align: middle;
  /*width: 90%;*/
  flex:1;
  margin-right: -.13rem;
  box-sizing: border-box;
}
.progress-bar__outer {
  /*height: .028rem;*/
  height:100%;
  overflow: hidden;
  position: relative;
  vertical-align: middle;
  display:flex;
  align-items: center
}
.progress-bar__inner {
  /*position: absolute;*/
  /*left: 0;*/
  /*top: 0;*/
  height: .028rem;
  /*height: 100%;*/
  background-color: #409eff;
  text-align: right;
  line-height: 1;
  white-space: nowrap;
  transition: width .6s ease;
}
.progress__text {
  font-size: .06rem;
  color: #59baf2;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
  padding-left: 0.05rem;
}
</style>