forked from N3-components/N3-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
n3Step.vue
64 lines (60 loc) · 1.57 KB
/
n3Step.vue
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
60
61
62
63
64
<template>
<ul v-if="round" class="{{prefixCls}}-steps-round-con">
<template v-for="label in labels">
<li :class="[getClassFromIndex($index)]">
<div class="{{prefixCls}}-steps-wrap">
<div class="{{prefixCls}}-steps-round">{{$index + 1}}</div>
</div>
<label>{{label}}</label>
</li>
</template>
</ul>
<div v-else class="{{prefixCls}}-steps clearfix">
<template v-for="label in labels">
<div class="{{prefixCls}}-steps-wrap">
<div :class="getClassFromIndex($index)">
<label>
<span class="{{prefixCls}}-steps-round">{{$index + 1}}</span>
<span>{{label}}</span>
</label>
<template v-if="$index < labels.length - 1">
<i class="{{prefixCls}}-steps-triangle-right-bg"></i>
<i class="{{prefixCls}}-steps-triangle-right"></i>
</template>
</div>
</div>
</template>
</div>
</template>
<script>
export default {
props: {
labels: {
type: Array
},
current: {
type: Number
},
round: {
type: Boolean
},
prefixCls: {
type: String,
default: 'n3'
}
},
methods: {
getClassFromIndex (index) {
let ret = ''
if (index === this.current - 1) {
ret = 'current'
} else if (index < this.current - 1) {
ret = 'finished'
} else {
ret = 'todo'
}
return this.prefixCls + '-steps-' + ret
}
}
}
</script>