|
|
@ -1,9 +1,10 @@ |
|
|
|
<template> |
|
|
|
<div class='TimeLine2'> |
|
|
|
<div class="TimeLine2"> |
|
|
|
<!-- { "time": "2024/4/16 11:30:07", "name": "1", "desc": "111", "source": 1 } --> |
|
|
|
<div class="node" v-for="(item, index) in data" :key="index"> |
|
|
|
<div class="content" v-if="direction != 'right'"> |
|
|
|
<!-- <template v-if="direction === 'auto' ? !!((index + 1) & 1) : true"> --> |
|
|
|
<template v-if="getDirection(item, index, 'left')"> |
|
|
|
<div class="content"> |
|
|
|
<template v-if="item.source == 2"> |
|
|
|
<!-- <template v-if="direction === 'auto' ? !!((index + 1) & 1) : true"> --> |
|
|
|
<span class="title" v-if="item.title">{{ item.title }}</span> |
|
|
|
<DescCard :data="item" /> |
|
|
|
</template> |
|
|
@ -12,13 +13,15 @@ |
|
|
|
<div class="circle"></div> |
|
|
|
<div class="line"></div> |
|
|
|
</div> |
|
|
|
<div class="content" v-if="direction != 'left'"> |
|
|
|
<!-- <template v-if="direction === 'auto' ? !((index + 1) & 1) : true"> --> |
|
|
|
<template v-if="getDirection(item, index, 'right')"> |
|
|
|
<div class="content"> |
|
|
|
<template v-if="item.source == 1"> |
|
|
|
<!-- <template v-if="direction === 'auto' ? !((index + 1) & 1) : true"> --> |
|
|
|
<!-- <template v-if="getDirection(item, index, 'right')"> --> |
|
|
|
<span class="title" v-if="item.title">{{ item.title }}</span> |
|
|
|
<slot name="content" :data="item"> |
|
|
|
<DescCard :data="item" /> |
|
|
|
</slot> |
|
|
|
<!-- </template> --> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -26,12 +29,12 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import DescCard from "./DescCard.vue" |
|
|
|
import DescCard from "./DescCard.vue"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'TimeLine2', |
|
|
|
name: "TimeLine2", |
|
|
|
components: { |
|
|
|
DescCard |
|
|
|
DescCard, |
|
|
|
}, |
|
|
|
props: { |
|
|
|
/** |
|
|
@ -46,7 +49,7 @@ export default { |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
type: Array, |
|
|
|
default: () => [] |
|
|
|
default: () => [], |
|
|
|
}, |
|
|
|
/** |
|
|
|
* auto 左右 显示 |
|
|
@ -55,26 +58,26 @@ export default { |
|
|
|
*/ |
|
|
|
direction: { |
|
|
|
type: String, |
|
|
|
default: "auto" |
|
|
|
} |
|
|
|
default: "auto", |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getDirection(item, index, position) { |
|
|
|
if (this.direction != 'auto') return this.direction === position; |
|
|
|
if (this.direction != "auto") return this.direction === position; |
|
|
|
if (item.direction) return item.direction === position; |
|
|
|
|
|
|
|
switch (position) { |
|
|
|
case 'left': |
|
|
|
return !!((index + 1) & 1) |
|
|
|
case 'right': |
|
|
|
return !((index + 1) & 1) |
|
|
|
case "left": |
|
|
|
return !!((index + 1) & 1); |
|
|
|
case "right": |
|
|
|
return !((index + 1) & 1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang='scss' scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.TimeLine2 { |
|
|
|
color: #fff; |
|
|
|
overflow-y: auto; |
|
|
@ -90,7 +93,7 @@ export default { |
|
|
|
margin-top: 24px; |
|
|
|
} |
|
|
|
|
|
|
|
>.content { |
|
|
|
> .content { |
|
|
|
flex: 1; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
@ -105,7 +108,7 @@ export default { |
|
|
|
.title { |
|
|
|
font-size: 16px; |
|
|
|
font-weight: 500; |
|
|
|
color: #FFC368; |
|
|
|
color: #ffc368; |
|
|
|
line-height: 19px; |
|
|
|
} |
|
|
|
} |
|
|
@ -123,7 +126,7 @@ export default { |
|
|
|
border-radius: 50%; |
|
|
|
opacity: 1; |
|
|
|
|
|
|
|
border: 1px solid var(--active-color, #39D5BF); |
|
|
|
border: 1px solid var(--active-color, #39d5bf); |
|
|
|
position: relative; |
|
|
|
|
|
|
|
&::before { |
|
|
@ -135,14 +138,14 @@ export default { |
|
|
|
left: 50%; |
|
|
|
top: 50%; |
|
|
|
transform: translate(-50%, -50%); |
|
|
|
background-color: var(--active-color, #39D5BF); |
|
|
|
background-color: var(--active-color, #39d5bf); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.line { |
|
|
|
width: 2px; |
|
|
|
min-height: 100%; |
|
|
|
background: #00B3CC; |
|
|
|
background: #00b3cc; |
|
|
|
border-radius: 0px 0px 0px 0px; |
|
|
|
opacity: 1; |
|
|
|
} |
|
|
|