Commit 48921bf57d4896c2419dc1dc4bb54bc34a27b37d

Authored by Rijn
1 parent 7f08fb51

add vertical progressbar

examples/routers/progress.vue
... ... @@ -10,6 +10,11 @@
10 10 <Icon type="checkmark-circled"></Icon>
11 11 <span>成功</span>
12 12 </i-progress>
  13 + <i-progress :percent="percent"></i-progress>
  14 + <div style="height: 150px">
  15 + <i-progress vertical :percent="percent" :stroke-width="20" hide-info></i-progress>
  16 + <i-progress vertical :percent="percent"></i-progress>
  17 + </div>
13 18 </div>
14 19 </template>
15 20 <script>
... ...
src/components/progress/progress.vue
... ... @@ -43,6 +43,10 @@
43 43 strokeWidth: {
44 44 type: Number,
45 45 default: 10
  46 + },
  47 + vertical: {
  48 + type: Boolean,
  49 + default: false
46 50 }
47 51 },
48 52 data () {
... ... @@ -68,7 +72,10 @@
68 72 return type;
69 73 },
70 74 bgStyle () {
71   - return {
  75 + return this.vertical ? {
  76 + height: `${this.percent}%`,
  77 + width: `${this.strokeWidth}px`
  78 + } : {
72 79 width: `${this.percent}%`,
73 80 height: `${this.strokeWidth}px`
74 81 };
... ... @@ -78,7 +85,8 @@
78 85 `${prefixCls}`,
79 86 `${prefixCls}-${this.currentStatus}`,
80 87 {
81   - [`${prefixCls}-show-info`]: !this.hideInfo
  88 + [`${prefixCls}-show-info`]: !this.hideInfo,
  89 + [`${prefixCls}-vertical`]: this.vertical
82 90  
83 91 }
84 92 ];
... ...
src/styles/components/progress.less
... ... @@ -2,7 +2,13 @@
2 2  
3 3 .@{progress-prefix-cls} {
4 4 display: inline-block;
  5 +
5 6 width: 100%;
  7 + &-vertical {
  8 + height: 100%;
  9 + width: auto;
  10 + }
  11 +
6 12 font-size: @font-size-small;
7 13 position: relative;
8 14  
... ... @@ -17,6 +23,10 @@
17 23 margin-right: -55px;
18 24 }
19 25 }
  26 + &-vertical &-outer {
  27 + height: 100%;
  28 + width: auto;
  29 + }
20 30  
21 31 &-inner {
22 32 display: inline-block;
... ... @@ -25,6 +35,20 @@
25 35 border-radius: 100px;
26 36 vertical-align: middle;
27 37 }
  38 + &-vertical &-inner {
  39 + height: 100%;
  40 + width: auto;
  41 +
  42 + & > *, &:after {
  43 + display: inline-block;
  44 + vertical-align: bottom;
  45 + }
  46 +
  47 + &:after {
  48 + content: '';
  49 + height: 100%;
  50 + }
  51 + }
28 52  
29 53 &-bg {
30 54 border-radius: 100px;
... ...