Authored by TaoHuang

fix

<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>
... ...
<template>
<LayoutApp title="邀新返佣" :show-back="false">
<div class="body">
<div class="body" ref="body">
<Banner></Banner>
<List></List>
</div>
... ... @@ -19,11 +19,19 @@ import {createNamespacedHelpers} from 'vuex';
const {mapActions} = createNamespacedHelpers('gain');
export default {
provide() {
return {
getBody: this.getBodyElem
};
},
mounted() {
this.fetchResource();
},
methods: {
...mapActions(['fetchResource'])
...mapActions(['fetchResource']),
getBodyElem(found) {
return found && found(this.$refs.body);
}
},
components: {
LayoutApp: Layout,
... ...
{
"name": "ufo-app-web",
"version": "1.0.9",
"version": "1.0.10",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...