fix: 修复时间轴跨天时显示不准确,以及跨天后切换时间导致时间轴异常的问题

This commit is contained in:
刘洪洪
2024-09-13 15:41:44 +08:00
parent 269d397743
commit 74fb0e3d1a
2 changed files with 4 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
<el-slider v-model="currentTime" @change="onChange" :step="1" :max="timeLine.length>0?timeLine.length-1:99" :format-tooltip="formatTooltip"/>
</div>
<div class="time-line-container">
<div v-for="item in timeLine" :key="item.time">
<div v-for="item in timeLine" :key="item.stamp">
<div v-if="item.showFlag" style="color: #666;">{{ item.time }}</div>
</div>
</div>
@@ -111,7 +111,8 @@ export default {
const month = date.getMonth() + 1
const day = date.getDate()
const obj = {
time: `${date.getFullYear()}-${month < 10 ? ('0' + month) : month}-${day < 10 ? ('0' + day) : day}`,
// time: `${date.getFullYear()}-${month < 10 ? ('0' + month) : month}-${day < 10 ? ('0' + day) : day}`,
time: `${month < 10 ? ('0' + month) : month}-${day < 10 ? ('0' + day) : day}`,
time1: changeTimestampToTime(timestamp).substring(0, changeTimestampToTime(timestamp).length - 3),
showFlag: false
}

View File

@@ -12,7 +12,7 @@
</div>
<div class="timeline__line margin-l-30"></div>
<div class="timeline-container margin-l-25" id="timeline-container">
<div v-for="item in timeLine" :key="item.time" :style="{width: item.isYear ? '5px' : 'auto'}">
<div v-for="item in timeLine" :key="item.stamp" :style="{width: item.isYear ? '5px' : 'auto'}">
<div v-if="item.showFlag" :class="handleTransformClass(item.isYear)">{{ item.time }}</div>
</div>
</div>