...
|
...
|
@@ -64,9 +64,8 @@ export default { |
|
|
navHeight: 0,
|
|
|
isShow: false,
|
|
|
total: 0,
|
|
|
marginTop: 0,
|
|
|
active: 0,
|
|
|
params: {
|
|
|
listBaseParams: {
|
|
|
isHome: true,
|
|
|
}
|
|
|
};
|
...
|
...
|
@@ -78,40 +77,45 @@ export default { |
|
|
return get(find(this.channelList.list, ['template_name', 'guessLike']), 'data') || [];
|
|
|
}
|
|
|
},
|
|
|
async serverPrefetch() {
|
|
|
return this.fetchChannelList();
|
|
|
},
|
|
|
mounted() {
|
|
|
this.fetchChannelList().then((res) => {
|
|
|
this.$nextTick(() => {
|
|
|
this.navTop = this.$refs.topSource.offsetHeight;
|
|
|
this.navHeight = get(this.$refs, 'scrollNav.offsetHeight') || 0;
|
|
|
this.total = this.$refs.scroll.$el.offsetHeight - this.navHeight;
|
|
|
});
|
|
|
|
|
|
res.forEach((item) => {
|
|
|
if (item.template_name == "guessLike") {
|
|
|
let url = item.data[0].url.split("?");
|
|
|
this.params = queryString.parse(url[1]);
|
|
|
}
|
|
|
})
|
|
|
this.fetchProductList(this.params);
|
|
|
this.$nextTick(() => {
|
|
|
this.navTop = this.$refs.topSource.offsetHeight;
|
|
|
this.navHeight = get(this.$refs, 'scrollNav.offsetHeight') || 0;
|
|
|
this.total = this.$refs.scroll.$el.offsetHeight - this.navHeight;
|
|
|
this.refreshProductList(this.active);
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['fetchChannelList']),
|
|
|
...mapActionsList(['fetchProductList']),
|
|
|
getIndex(index) {
|
|
|
this.active = Number(index);
|
|
|
},
|
|
|
scrollHandler({ y }) {
|
|
|
let scrollY = Math.abs(parseInt(y));
|
|
|
if (scrollY >= this.navTop) {
|
|
|
this.isShow = true;
|
|
|
} else {
|
|
|
this.isShow = false;
|
|
|
if (this.navTop) {
|
|
|
let scrollY = -y;
|
|
|
|
|
|
if (scrollY >= this.navTop) {
|
|
|
this.isShow = true;
|
|
|
} else {
|
|
|
this.isShow = false;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
...mapActions(['fetchChannelList']),
|
|
|
...mapActionsList(['fetchProductList']),
|
|
|
refreshProductList(index) {
|
|
|
let str = get(get(this.navList, `[${index}].url`, '').split('?'), '[1]', '');
|
|
|
|
|
|
this.params = Object.assign({}, queryString.parse(str), this.listBaseParams);
|
|
|
this.fetchProductList(this.params);
|
|
|
},
|
|
|
async onPullingUp() {
|
|
|
this.params.isReset = false
|
|
|
await this.fetchProductList(this.params);
|
|
|
if (this.params) {
|
|
|
this.params.isReset = false
|
|
|
await this.fetchProductList(this.params);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
components: {
|
...
|
...
|
|