7fa943eb
梁灏
init
|
1
2
3
|
<template>
<li :class="itemClasses">
<div :class="tailClasses"></div>
|
6c9e0282
huixisheng
Support timeline
|
4
|
<div :class="headClasses" :style="customColor" ref="dot"><slot name="dot"></slot></div>
|
7fa943eb
梁灏
init
|
5
6
7
8
9
10
11
12
13
|
<div :class="contentClasses">
<slot></slot>
</div>
</li>
</template>
<script>
const prefixCls = 'ivu-timeline';
export default {
|
34ee7b4a
梁灏
support Tree & ad...
|
14
|
name: 'TimelineItem',
|
7fa943eb
梁灏
init
|
15
16
17
18
19
20
21
22
23
|
props: {
color: {
type: String,
default: 'blue'
}
},
data () {
return {
dot: false
|
b0893113
jingsam
add eslint
|
24
|
};
|
7fa943eb
梁灏
init
|
25
|
},
|
6c9e0282
huixisheng
Support timeline
|
26
27
|
mounted () {
this.dot = this.$refs.dot.innerHTML.length ? true : false;
|
7fa943eb
梁灏
init
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
},
computed: {
itemClasses () {
return `${prefixCls}-item`;
},
tailClasses () {
return `${prefixCls}-item-tail`;
},
headClasses () {
return [
`${prefixCls}-item-head`,
{
[`${prefixCls}-item-head-custom`]: this.dot,
[`${prefixCls}-item-head-${this.color}`]: this.headColorShow
}
|
b0893113
jingsam
add eslint
|
43
|
];
|
7fa943eb
梁灏
init
|
44
45
46
47
48
49
50
51
52
53
54
|
},
headColorShow () {
return this.color == 'blue' || this.color == 'red' || this.color == 'green';
},
customColor () {
let style = {};
if (this.color) {
if (!this.headColorShow) {
style = {
'color': this.color,
'border-color': this.color
|
b0893113
jingsam
add eslint
|
55
|
};
|
7fa943eb
梁灏
init
|
56
57
58
59
60
61
62
63
64
|
}
}
return style;
},
contentClasses () {
return `${prefixCls}-item-content`;
}
}
|
b0893113
jingsam
add eslint
|
65
66
|
};
</script>
|