element 远程搜索下拉加载
创始人
2024-05-29 10:27:59

created() {
this.getList();
this.getGroupList();
},
directives: {
/** 下拉框懒加载 */
“el-select-loadmore”: {
bind(el, binding) {
const SELECTWRAP_DOM = el.querySelector(
“.el-select-dropdown .el-select-dropdown__wrap”
);
SELECTWRAP_DOM.addEventListener(“scroll”, function () {
const condition =
this.scrollHeight - this.scrollTop <= this.clientHeight;
if (condition) {
binding.value();
}
});
},
},
},

// 远程搜索
remoteMethod(query) {
if (query !== “”) {
this.shopList = [];
this.loadingshop = true;
this.shopParams.name = query;
this.shopParams.page = 1;
this.getcommodityList();
}
},
//下拉加载
loadMore() {
if (this.lastPage) return;
this.shopParams.page++;
this.getcommodityList();
},
// 获取商品列表
getcommodityList() {
getGoodsList(this.shopParams).then((response) => {
this.lastPage = response.data.paginationResponse.lastPage;
var newShop = response.data.paginationResponse.content;
this.shopList = this.shopList.concat(newShop);
this.loadingshop = false;
});
},

相关内容

热门资讯

示意图看国道216线抢通最新进... 转自:央视新闻客户端西藏吉隆县泥石流灾害抢险救援进入第7天,各项抢险救援救灾工作持续推进。一起通过中...
美股异动 | 芯片股普跌 高通... 周二,芯片股普跌,高通(QCOM.US)跌逾4%,英特尔(INTC.US)、美国超微公司(AMD.U...
美国8月标普制造业采购经理指数... 标普全球9月1日发布数据显示,美国8月制造业采购经理指数报53.9。
被“抢饭碗”吓崩Howmet(... 航空航天精密零部件巨头Howmet Aerospace(HWM.US)周一收盘大跌7.51%,盘中一...
北特科技新增质押1200万股 ... 9月1日,北特科技公告,控股股东靳坤将其持有的北特科技1200.00万股股份进行质押,质押用途为质押...