You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

71 lines
1.5 KiB

<template>
<v-scroll @load="load" :refresher-enabled="refresherEnabled" @ref="ref" ref="scroll">
<slot name="box" v-bind="list">
</slot>
</v-scroll>
</template>
<script>
export default {
name:'paging',
props: {
data: {
default() {
return {};
},
type: Object,
require: false,
},
refresherEnabled:{
default:true,
required:false,
type:Boolean
},
ajax: {
require: true,
type: Function,
},
},
data() {
return {
list: [],
page: 0,
};
},
methods: {
load(over) {
this.page++;
this.getList(over);
},
ref(over) {
this.page = 1;
this.getList(over);
},
getList(over) {
let data = {}
if(this.$router.currentRoute.fullPath=='/pages/exchange/exchangeHis'){
data = Object.assign({page: this.page,symbol: sessionStorage.getItem('symbol')},this.data);
}else{
data = Object.assign({page: this.page,},this.data);
}
// let data = Object.assign({page: this.page,symbol: sessionStorage.getItem('symbol')},this.data);
this.ajax(data).then((res) => {
let queryVo = res.data;
if (queryVo.current_page == 1) this.list = [];
this.list = [...this.list, ...queryVo.data];
over &&
over({
finished: queryVo.data.length < queryVo.per_page,
});
});
},
},
watch: {
'$route' (to, from) {
if(to.query.coin_name){
this.getList();
}
}
},
created() {},
};
</script>