<template>
|
<the-a-date :data="date" />
|
<div class="travel-lines">
|
<div v-for="(line, key) in newData" :key="key" class="travel-line">
|
<div v-for="(item, index) in line" :key="index" :class="`div-${item.type}`">
|
<div>{{ item.type }}</div>
|
<section>
|
<span></span>
|
</section>
|
<p>
|
<span>{{ item.title }}</span>
|
<span>{{ item.content }}</span>
|
</p>
|
</div>
|
</div>
|
</div>
|
</template>
|
<script lang="ts" setup name="TheTravelLine">
|
const props = withDefaults(
|
defineProps<{
|
date?: string;
|
data?: Array<any>;
|
}>(),
|
{
|
data: () => [],
|
date: ""
|
}
|
);
|
const newData = computed(() => {
|
let max = 6;
|
let result = [];
|
let newArray = [];
|
for (let i = 0; i < props.data.length; i += max) {
|
result.push(props.data.slice(i, i + max));
|
}
|
for (let i = 0; i < result.length; i++) {
|
if (i % 2 > 0) {
|
const reverseArray = result[i].reverse();
|
const number = max - reverseArray.length;
|
for (let index = 0; index < number; index++) {
|
reverseArray.unshift({
|
type: "none"
|
});
|
}
|
newArray.push(reverseArray);
|
} else {
|
newArray.push(result[i]);
|
}
|
}
|
return newArray;
|
});
|
</script>
|
<style lang="scss" scoped>
|
.travel-lines {
|
margin: 0 100px;
|
.travel-line {
|
display: flex;
|
&:nth-child(even) {
|
> div {
|
&:last-child {
|
position: relative;
|
&:after {
|
content: "";
|
position: absolute;
|
bottom: 65px;
|
right: 50px;
|
width: 50px;
|
height: 180px;
|
display: block;
|
border-radius: 0 40px 40px 0;
|
box-sizing: border-box;
|
border: 2px solid rgba(204, 214, 214, 0.4);
|
border-left: none;
|
}
|
}
|
}
|
}
|
&:nth-child(odd) {
|
> div {
|
&:first-child {
|
position: relative;
|
&:before {
|
content: "";
|
position: absolute;
|
bottom: 65px;
|
left: -60px;
|
width: 50px;
|
height: 180px;
|
display: block;
|
border-radius: 40px 0 0 40px;
|
box-sizing: border-box;
|
border: 2px solid rgba(204, 214, 214, 0.4);
|
border-right: none;
|
}
|
}
|
}
|
}
|
&:first-child {
|
> div {
|
&:first-child {
|
position: relative;
|
&:before {
|
content: "";
|
display: none;
|
}
|
}
|
}
|
}
|
> div {
|
flex: 1;
|
margin-bottom: 50px;
|
padding: 50px 0;
|
display: flex;
|
align-items: center;
|
position: relative;
|
section {
|
flex: 1;
|
margin: 0 20px;
|
display: flex;
|
align-items: center;
|
> span {
|
width: 100%;
|
background: rgba(204, 214, 214, 0.4);
|
display: block;
|
height: 2px;
|
}
|
}
|
&:last-child {
|
section {
|
display: none;
|
}
|
}
|
&.div-in {
|
> p {
|
bottom: 0;
|
}
|
> div {
|
background: #0e9cff;
|
}
|
}
|
&.div-none {
|
opacity: 0;
|
}
|
&.div-out {
|
> p {
|
top: 0;
|
}
|
> div {
|
background: #ff9d35;
|
}
|
}
|
> p {
|
position: absolute;
|
left: 0;
|
> span {
|
display: block;
|
&:first-child {
|
font-size: 16px;
|
font-weight: bold;
|
line-height: 22px;
|
margin-bottom: 5px;
|
}
|
&:last-child {
|
font-size: 12px;
|
}
|
}
|
}
|
|
> div {
|
width: 32px;
|
height: 32px;
|
border-radius: 4px;
|
line-height: 30px;
|
text-align: center;
|
font-size: 16px;
|
font-weight: bold;
|
color: #fff;
|
}
|
}
|
}
|
}
|
</style>
|