scroll-view.vue
1011 Bytes
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
<template>
<div class="list-wrapper">
<Scroll ref="scroll" :options="options" @pulling-up="reachBottom" @pulling-down="pullRefresh" :data="data">
<slot></slot>
</Scroll>
</div>
</template>
<script>
import {Scroll} from 'cube-ui';
export default {
name: 'yoho-scroll-view',
props: {
options: {
type: Object,
default() {
return {};
}
},
pullRefresh: {
type: Function,
default() {
return {};
}
},
reachBottom: {
type: Function,
default() {
return {};
}
},
data: {
type: Array,
default() {
return [];
}
}
},
methods: {
forceUpdate() {
this.$refs.scroll.forceUpdate();
},
scrollTo(x, y) {
this.$refs.scroll.scrollTo(x, y, 1000);
}
},
components: {
Scroll
}
};
</script>
<style lang="scss" scoped>
.list-wrapper {
position: relative;
height: 100%;
overflow: hidden;
background-color: #f0f0f0;
}
</style>