赞
踩
此组件一般用于标识页面底部加载数据时的状态,共有三种状态:
onReachBottom
生命周期- <u-loadmore :status="status" />
-
- data:
-
- list: [],
- status: "loadmore",
- pages: "1",
- limit: {
- pageNum: 1,
- pageSize: 10,
- },
-
- onShow() {
- this.init();
- },
- onLoad() {},
- async onReachBottom() {
- console.log("onReachBottom");
- if (this.limit.pageNum >= this.pages) {
- this.status = "nomore";
- return;
- }
- this.status = "loading";
- this.limit.pageNum = ++this.limit.pageNum;
- await this.init();
- },
-
- methods:
-
- init() {
- const q = {
- ...this.limit,
- };
- queryAppointList(q).then(
- (res) => {
- if (res && res.data) {
- this.pages = res.data.pages;
- this.list = this.list.concat(res.data.records);
- if (this.limit.pageNum >= this.pages) this.status = "nomore";
- else this.status = "loading";
- console.log(this.status, "状态");
- }
- },
- () => {}
- );
- },
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。