Commit d127fed2 by levlin

Merge branch 'dev'

parents dd46fa45 729d826c
......@@ -29,6 +29,7 @@
</template>
<script>
import { mapGetters } from "vuex";
export default {
name: "Timeline",
props: {
......@@ -44,6 +45,7 @@ export default {
};
},
computed: {
...mapGetters({ channelInfo: "channelInfo" }),
timeData() {
let timeArr = [];
const WEEK_CONFIG = {
......@@ -57,8 +59,9 @@ export default {
};
const oneDayTime = 86400000;
const { currentTime } = this;
const playbackDay = this.channelInfo?.playbackDay || 7;
// 创建时间轴数据
for (let i = 0; i <= 7; i++) {
for (let i = 0; i <= playbackDay; i++) {
const leftTimestamp = currentTime - i * oneDayTime;
const leftDate = new Date(leftTimestamp);
const timeData = {
......@@ -88,15 +91,21 @@ export default {
mounted() {
// 老版
this.$nextTick(() => {
// 默认激活第7个tab,也就是“今天”
// 查找"今天"的索引
const todayIndex = this.timeData.findIndex(item => item.week === '今天');
if (todayIndex !== -1) {
this.activeTab = todayIndex;
}
// 默认激活找到的tab
this.scrollTo("activatedItem", this.activeTab);
});
// 新版
this.$Bus.$on('first-playBill', () => {
this.$Bus.$on("first-playBill", () => {
this.$nextTick(() => {
// 同样,在新版逻辑中也查找"今天"的索引
this.scrollTo("activatedItem", this.activeTab);
});
})
});
},
methods: {
changeTab(info, index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment