Blame view

ant-design-vue-jeecg/src/components/chart/MiniProgress.vue 1.45 KB
1
2
3
<template>
  <div class="chart-mini-progress">
    <div class="target" :style="{ left: target + '%'}">
4
      <span :style="{ backgroundColor: color }"/>
5
6
7
      <span :style="{ backgroundColor: color }"/>
    </div>
    <div class="progress-wrapper">
8
      <div class="progress" :style="{ backgroundColor: color, width: percentage + '%', height: height+'px' }"></div>
9
10
11
12
13
14
    </div>
  </div>
</template>

<script>
  export default {
15
    name: 'MiniProgress',
16
17
18
19
20
21
    props: {
      target: {
        type: Number,
        default: 0
      },
      height: {
22
23
        type: Number,
        default: 10
24
25
26
27
28
29
30
31
32
33
34
35
36
      },
      color: {
        type: String,
        default: '#13C2C2'
      },
      percentage: {
        type: Number,
        default: 0
      }
    }
  }
</script>
37
<style lang="less" scoped>
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  .chart-mini-progress {
    padding: 5px 0;
    position: relative;
    width: 100%;

    .target {
      position: absolute;
      top: 0;
      bottom: 0;

      span {
        border-radius: 100px;
        position: absolute;
        top: 0;
        left: 0;
        height: 4px;
        width: 2px;

        &:last-child {
          top: auto;
          bottom: 0;
        }
      }
    }
    .progress-wrapper {
      background-color: #f5f5f5;
      position: relative;

      .progress {
67
        transition: all .4s cubic-bezier(.08, .82, .17, 1) 0s;
68
69
70
71
72
73
74
75
        border-radius: 1px 0 0 1px;
        background-color: #1890ff;
        width: 0;
        height: 100%;
      }
    }
  }
</style>