layout-scroll.vue
891 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
<template>
<RecycleList ref="scroll" :on-fetch="onFetch" :options="scrollOption" @pulling-up="onPullingUp" @pulling-down="onPullingDown" @scroll="onScroll">
<template slot="item" slot-scope="{ data }">
<slot name="item" :data="data">
</slot>
</template>
</RecycleList>
</template>
<script>
import {Scroll} from 'cube-ui';
export default {
name: 'LayoutScroll',
props: {
onFetch: Function,
infinite: Boolean,
scrollOption: {
type: Object,
default() {
return {
pullDownRefresh: true,
observeDOM: false,
pullUpLoad: true
};
}
}
},
methods: {
onPullingUp(evt) {
this.$emit('pulling-up', evt);
},
onPullingDown(evt) {
this.$emit('pulling-down', evt);
},
onScroll(evt) {
this.$emit('scroll', evt);
}
},
components: {Scroll}
};
</script>