效果如下:
代码:
data中定义:
optionsMatching: [],
scanBlurry: [],
loading: false,
remoteMethod方法
remoteMethod(query) {
let _this = this;
if (query !== "") {
_this.loading = true;
searchMatching(query).then((res) => {
_this.loading = false;
_this.optionsMatching = res.map((item, index) => {
return {
value: item,
label: item,
index: index,
};
});
console.log(_this.optionsMatching, "_this.optionsMatching");
});
} else {
this.optionsMatching = [];
}
},



