channel.vue
2.75 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<template>
<div class="scroll-app">
<div class="scroll-flex">
<div class="scroll-list-wrap">
<Scroll
ref="scroll"
:options="options"
@pulling-up="onPullingUp"
:data="channelList.productlist">
<div class="body" ref="body">
<div class="channel-top"></div>
<div v-for="(item, index) in channelList.list" :key="index">
<Slider :list="item.data" v-if="item.template_name == 'focus'" />
<Hot :list="item.data" v-if="item.template_name == 'hotSeries'" />
<Banner :list="item.data" v-if="item.template_name == 'single_image'" />
<TwoBanner :list="item.data" v-if="item.template_name == 'twoPicture'" />
</div>
<ScrollNav></ScrollNav>
<ProductList :list="channelList.productlist"></ProductList>
</div>
</Scroll>
</div>
</div>
</div>
</template>
<script>
import { Style, Scroll } from 'cube-ui'
import { createNamespacedHelpers } from 'vuex';
import Slider from './components/slider';
import Banner from './components/banner';
import TwoBanner from './components/twoBanner';
import Hot from './components/hot';
import ScrollNav from './components/scrollNav';
import ProductList from '../../list/components/productList';
const { mapState, mapActions } = createNamespacedHelpers('home/channel');
export default {
data() {
return {
options: {
bounce: {
top: false
},
pullUpLoad: true
},
}
},
computed: {
...mapState(['channelList']),
},
mounted() {
const params = {
isPage: true
}
this.fetchChannelList();
this.fetchProductList(params);
},
created() {
},
methods: {
...mapActions(['fetchChannelList','fetchProductList']),
async onPullingUp() {
const params = {
isReset: false
}
await this.fetchProductList(params);
this.$refs.scroll.forceUpdate()
}
},
components: {
Slider,
Banner,
TwoBanner,
Hot,
ScrollNav,
Style,
Scroll,
ProductList
}
};
</script>
<style lang="scss" scoped>
.channel-top {
width: 100%;
height: 400px;
background: #08304B;
}
.scroll-app {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
font-size: 0.6rem;
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
flex-direction: column;
}
.scroll-flex {
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
overflow: hidden;
position: relative;
}
.scroll-list-wrap {
height: 100%;
width: 100%;
}
.body {
height: 100%;
overflow-y: auto;
// padding: 0 40px;
}
</style>