1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
| <template>
| <!-- 进度条组件 -->
| <div class="progress-box" :style="{ height: strokeWidth + 'px' }">
| <div
| v-if="showBlock"
| class="the-block"
| :style="{ left: percentage + '%', width: strokeWidth + 2 + 'px', height: strokeWidth + 2 + 'px' }"
| ></div>
| <div :style="{ background: color, width: percentage + '%' }" class="bar"></div>
| </div>
| </template>
|
| <script>
| export default {
| props: {
| // 进度条颜色
| color: {
| type: String,
| default: '#000',
| },
| // 当前进度
| percentage: {
| type: Number,
| default: 100,
| },
| // 进度条宽度
| strokeWidth: {
| type: Number,
| default: 10,
| },
| // 是否显示滑块ui
| showBlock: {
| type: Boolean,
| default: false,
| },
| },
| };
| </script>
|
| <style lang="scss" scoped>
| .progress-box {
| background-color: rgba(208, 222, 238, 0.1);
| border-radius: 100px;
| position: relative;
| .bar {
| height: 100%;
| border-radius: 100px;
| }
|
| .the-block {
| border-radius: 50%;
| background-color: #ffffff;
| box-shadow: 0px 0px 4px 0px #efd48e;
| position: absolute;
| top: 50%;
| transform: translate(-5%, -50%);
| }
| }
| </style>
|
|