|
|
<template>
|
|
|
<div class="list-comp">
|
|
|
<div class="title">邀请记录</div>
|
|
|
<div class="header-wrapper">
|
|
|
<div :class="getClass" ref="header">
|
|
|
<div class="header">
|
|
|
<div style="width: 25%; text-align: left;">我邀请的好友</div>
|
|
|
<div class="register-time">注册时间</div>
|
...
|
...
|
@@ -32,15 +32,22 @@ import {createNamespacedHelpers} from 'vuex'; |
|
|
const {mapState, mapActions} = createNamespacedHelpers('gain');
|
|
|
|
|
|
export default {
|
|
|
inject: ['getBody'],
|
|
|
data() {
|
|
|
return {
|
|
|
scrollOptions: {
|
|
|
pullUpLoad: true
|
|
|
}
|
|
|
},
|
|
|
fixed: false
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
this.fetchList();
|
|
|
|
|
|
this.getBody(($body) => {
|
|
|
this.$body = $body;
|
|
|
$body.addEventListener('scroll', this.scroll);
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['fetchList']),
|
...
|
...
|
@@ -51,10 +58,22 @@ export default { |
|
|
if (!result) {
|
|
|
this.$refs.scroll.$forceUpdate();
|
|
|
}
|
|
|
},
|
|
|
scroll() {
|
|
|
if (this.$body.scrollTop >= this.$refs.header.offsetTop) {
|
|
|
this.fixed = true;
|
|
|
} else {
|
|
|
this.fixed = false;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['list'])
|
|
|
...mapState(['list']),
|
|
|
getClass() {
|
|
|
return ['header-wrapper', {
|
|
|
fixed: this.fixed
|
|
|
}];
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
Scroll
|
...
|
...
|
@@ -76,7 +95,7 @@ export default { |
|
|
}
|
|
|
|
|
|
.header-wrapper {
|
|
|
position: sticky;
|
|
|
position: relative;
|
|
|
height: 100px;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -87,6 +106,10 @@ export default { |
|
|
justify-content: space-between;
|
|
|
height: 100px;
|
|
|
line-height: 100px;
|
|
|
|
|
|
.fixed {
|
|
|
position: absolute;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.header:before {
|
...
|
...
|
@@ -132,5 +155,7 @@ export default { |
|
|
line-height: 350px;
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
</style> |
...
|
...
|
|