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;
});
},