防抖debounce
getTableData: _.debounce(async function () {
let params = {
pageIndex: this.currentPage,
pageSize: this.pageSize,
selectType: this.activeTabName
}
let res = await getIeoApplyList(params)
this.total = Number(res.data.total)
this.list = res.data.list
}, 500),
传参的方式
getDetailById: _.debounce(async function (id) {
let params = {id: id}
let res = await getIeoApplyDetail(params)
this.detailInfo = res.data
}, 500),
节流throttle
doPurchase: _.throttle(async function () {
const params = {
id: this.id,
rushNum: this.buyCount,
payPassword: this.$globalPayPassword_S_X
}
this.list = await doPurchaseAJAX(params)
}, 500),
网友评论