element分頁組件應用,回調事件和傳入的props,其中
這個支持異步的,接口請求過來的需要帶上異步修飾符sync,否則分頁按鈕會顯示不全
js代碼部分
methods: {
async gwt(oldUser, params) {
// console.log(Service.oldUerList(oldUser,params))
const result = await Service.oldUerList(oldUser, params);
console.log(result);
let data = result && result.data && result.data.records;
this.total = (result && result.data.total) || 1000;
this.totalPage = (result && result.data.pages) || 0;
this.tableData = data;
return result;
},
getData() {
this.gwt("oldUser", {
current: this.current,
size: this.size,
loginName: this.loginName,
orderId: this.orderId,
custmaincode: this.custmaincode,
custname: this.custname,
depaname: this.depaname,
collectiontype: this.collectiontype,
code: this.code,
timeSta: this.timeSta,
timeEnd: this.timeEnd
});
},
handleSizeChange(val) {
this.size = val;
this.getData();
},
handleCurrentChange(val) {
this.current = val;
this.getData();
},
pre(val) {
this.current = val - 1;
this.getData();
},
next(val) {
this.current = val + 1;
this.getData();
}
}
親測:
記錄昨天遇到的小問題,很簡單,不知道會很費時間
閱讀更多 紛亂的雨季 的文章