favorite.vue
1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<template>
<LayoutApp :show-back="true" :title="title">
<Scroll :scroll-events="['scroll-end','scroll']"
@scroll-end="fetchList(isMore)"
v-if="favoriteProductList.list.length"
>
<ProductList :list="favoriteProductList.list"></ProductList>
</Scroll>
<!-- <empty-list v-show="!isShowEmpty" /> -->
<UfoNoItem :tip="`暂无数据`" v-else></UfoNoItem>
</LayoutApp>
</template>
<script>
import ProductList from '../../list/components/productList';
import EmptyList from "../../order/order-list/components/empty";
import UfoNoItem from '../../../components/ufo-no-item'
import {Scroll} from 'cube-ui';
import {createNamespacedHelpers} from 'vuex';
const {mapState, mapActions} = createNamespacedHelpers('home/favorite');
export default {
name: 'list',
components: {
ProductList,
Scroll,
EmptyList,
UfoNoItem
},
data() {
return {
title: '我的收藏',
scrollOptions: {
bounce: {
top: false
},
pullUpLoad: true
},
fixed: false
};
},
mounted() {
this.fetchFavoriteList();
},
methods: {
...mapActions(['fetchFavoriteList']),
async fetchList(isMore) {
if(this.isMore){
await this.fetchFavoriteList();
}
},
// scroll({ y }) {
// const height = this.$refs.banner.$el.offsetHeight + this.$refs.header.offsetHeight;
// if (-y >= height) {
// this.fixed = true;
// } else {
// this.fixed = false;
// }
// }
},
computed: {
...mapState(['favoriteProductList','isMore']),
},
};
</script>
<style scoped>
</style>