list.vue
1.16 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
<template>
<div style="height: 100%; background-color: #f0f0f0;">
<ScrollView class="scroll-view" :data="ufoList" :options="scrollOptions" v-if="ufoList.length">
<CouponItem :item="item" v-for="(item, index) in ufoList" :key ="index"></CouponItem>
</ScrollView>
<Empty v-else></Empty>
</div>
</template>
<script>
import {createNamespacedHelpers} from 'vuex';
const {mapState} = createNamespacedHelpers('coupon/yoho');
import CouponItem from '../components/coupon-item';
import Empty from '../components/empty';
import ScrollView from '../components/scroll-view';
export default {
name: 'UfoCouponListPage',
computed: {
...mapState(['ufoList']),
},
data() {
return {
scrollOptions: {
directionLockThreshold: 0,
bounce: true
}
};
},
created() {
},
mounted() {
this.getList();
},
methods: {
getList() {
return this.$store.dispatch('coupon/yoho/fetchUfoList', {
limit: 100,
page: 1
});
}
},
components: {
ScrollView,
CouponItem,
Empty
}
};
</script>
<style lang="scss" scoped>
.scroll-view {
height: calc(100% - 90px);
}
</style>