You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.3 KiB

<!--
* @Author: aBin
* @email: binbin0314@126.com
* @Date: 2021-07-19 14:15:35
* @LastEditors: aBin
* @LastEditTime: 2021-07-20 14:22:11
-->
<template>
<!-- <Barrier /> -->
<scroll-view
:lower-threshold="300"
:scrollTop="scrollTop"
:scrollY="true"
:upper-threshold="300"
@scroll="scroll"
@scrolltolower="handleScrollBottom"
@scrolltoupper="handleScrollTop"
>
<TimeBox ref="child" />
</scroll-view>
</template>
<script>
// import Barrier from './component/Barrier.vue';
import { mapState, mapMutations } from 'vuex';
import TimeBox from './component/TimeBox.vue';
export default {
name: 'TimeLine',
components: { TimeBox },
data() {
return { scrollTop: 0, top: 0 };
},
computed: mapState('home', ['scrollTop', 'showTips']),
methods: {
...mapMutations('home', ['setScrollTop', 'setShrink']),
// 滚动
scroll(e) {
console.log(e.detail.scrollTop);
this.top = e.detail.scrollTop;
this.setShrink(this.top > this.scrollTop);
this.setScrollTop(this.top);
},
// 滚动到顶部
handleScrollTop() {
console.log('滚动到顶部');
this.$refs.child.addTopList();
},
// 滚动到底部
handleScrollBottom() {
console.log('滚动到底部');
this.$refs.child.addBottomList();
},
},
};
</script>