7fa943eb
梁灏
init
|
1
|
<template>
|
45b672ca
梁灏
add Steps UI
|
2
|
<div :class="wrapClasses" :style="styles">
|
d6342fe1
jingsam
fixed ie bug
|
3
4
5
|
<div :class="[prefixCls + '-tail']"><i></i></div>
<div :class="[prefixCls + '-head']">
<div :class="[prefixCls + '-head-inner']">
|
b450b555
huixisheng
update Steps
|
6
|
<span v-if="!icon && currentStatus != 'finish' && currentStatus != 'error'">{{ stepNumber }}</span>
|
7fa943eb
梁灏
init
|
7
8
9
|
<span v-else :class="iconClasses"></span>
</div>
</div>
|
d6342fe1
jingsam
fixed ie bug
|
10
11
12
|
<div :class="[prefixCls + '-main']">
<div :class="[prefixCls + '-title']">{{ title }}</div>
<div v-if="content" :class="[prefixCls + '-content']">{{ content }}</div>
|
7fa943eb
梁灏
init
|
13
14
15
16
17
18
19
20
21
22
|
</div>
</div>
</template>
<script>
import { oneOf } from '../../utils/assist';
const prefixCls = 'ivu-steps';
const iconPrefixCls = 'ivu-icon';
export default {
|
34ee7b4a
梁灏
support Tree & ad...
|
23
|
name: 'Step',
|
7fa943eb
梁灏
init
|
24
|
props: {
|
b450b555
huixisheng
update Steps
|
25
26
27
28
29
|
status: {
validator (value) {
return oneOf(value, ['wait', 'process', 'finish', 'error']);
}
},
|
7fa943eb
梁灏
init
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
title: {
type: String,
default: ''
},
content: {
type: String
},
icon: {
type: String
}
},
data () {
return {
prefixCls: prefixCls,
stepNumber: '',
|
45b672ca
梁灏
add Steps UI
|
45
|
nextError: false,
|
bd596e7a
huixisheng
support Steps
|
46
|
total: 1,
|
b450b555
huixisheng
update Steps
|
47
|
currentStatus: ''
|
b0893113
jingsam
add eslint
|
48
|
};
|
7fa943eb
梁灏
init
|
49
|
},
|
b450b555
huixisheng
update Steps
|
50
51
52
|
created () {
this.currentStatus = this.status;
},
|
7fa943eb
梁灏
init
|
53
54
55
56
|
computed: {
wrapClasses () {
return [
`${prefixCls}-item`,
|
b450b555
huixisheng
update Steps
|
57
|
`${prefixCls}-status-${this.currentStatus}`,
|
7fa943eb
梁灏
init
|
58
59
60
61
|
{
[`${prefixCls}-custom`]: !!this.icon,
[`${prefixCls}-next-error`]: this.nextError
}
|
b0893113
jingsam
add eslint
|
62
|
];
|
7fa943eb
梁灏
init
|
63
64
65
66
|
},
iconClasses () {
let icon = '';
|
b0893113
jingsam
add eslint
|
67
|
if (this.icon) {
|
7fa943eb
梁灏
init
|
68
69
|
icon = this.icon;
} else {
|
b450b555
huixisheng
update Steps
|
70
|
if (this.currentStatus == 'finish') {
|
7fa943eb
梁灏
init
|
71
|
icon = 'ios-checkmark-empty';
|
b450b555
huixisheng
update Steps
|
72
|
} else if (this.currentStatus == 'error') {
|
7fa943eb
梁灏
init
|
73
74
75
76
77
78
79
80
81
82
|
icon = 'ios-close-empty';
}
}
return [
`${prefixCls}-icon`,
`${iconPrefixCls}`,
{
[`${iconPrefixCls}-${icon}`]: icon != ''
}
|
b0893113
jingsam
add eslint
|
83
|
];
|
45b672ca
梁灏
add Steps UI
|
84
85
86
87
|
},
styles () {
return {
width: `${1/this.total*100}%`
|
b0893113
jingsam
add eslint
|
88
|
};
|
7fa943eb
梁灏
init
|
89
90
91
|
}
},
watch: {
|
b450b555
huixisheng
update Steps
|
92
93
94
|
status (val) {
this.currentStatus = val;
if (this.currentStatus == 'error') {
|
7fa943eb
梁灏
init
|
95
96
97
98
|
this.$parent.setNextError();
}
}
}
|
b0893113
jingsam
add eslint
|
99
|
};
|
d6342fe1
jingsam
fixed ie bug
|
100
|
</script>
|