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