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