<scroller class="scroller"
use-pullup :pullup-config="pullupDefaultConfig"
@on-pullup-loading="loadMore"
lock-x ref="scrollerBottom"
height="-48"
v-model="scrollerStatus">
<div class="main" >
<ul>
<li v-for="i in 100" :key=i>{{i}}</li>
</ul>
</div>
</scroller>
<script>
import { Scroller } from "vux";
export default {
components: {
Scroller
},
data() {
return {
pullupDefaultConfig: {
content: "",
pullUpHeight: 60,
height: 40,
autoRefresh: true,
downContent: "",
upContent: "",
loadingContent: "",
clsPrefix: "xs-plugin-pullup-"
}
};
},
mounted() {
this.$nextTick(() => {
this.$refs.scrollerBottom.reset({top: 0});
});
},
methods: {
refresh() {},
//加载更多
loadMore() {
this.page = this.page + 1;
this.getList(this.status);//获取列表数据
this.$refs.scrollerBottom.reset();
this.scrollerStatus.pullupStatus = "default";
},
//获取列表数据
getList(val) {
this.$vux.loading.show({
text: "加载中"
});
base
.get("/api/physician/records/?status=" + val + "&page=" + this.page)
.then(res => {
this.$vux.loading.hide();
if (res.data.status > 200000 && res.data.status < 400000) {
if (this.page == 1) {
this.recordeArr = res.data.msg;
} else {
this.recordeArr = this.recordeArr.concat(res.data.msg);
}
this.$refs.scrollerBottom.reset();
this.scrollerStatus.pullupStatus = "default";
} else {
this.$refs.scrollerBottom.reset();
this.scrollerStatus.pullupStatus = "default";
}
});
}
}