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