更新
This commit is contained in:
@@ -58,27 +58,33 @@ export default {
|
||||
remoteMethod(query) {
|
||||
if (query !== "") {
|
||||
this.loading = true;
|
||||
let params = {};
|
||||
let type = this.$utils.typeJudgment(this.config.autocompleteKey);
|
||||
if (!type.includes("Object") && !type.includes("String")) return;
|
||||
|
||||
// if (!type.includes("Object") && !type.includes("String")) {
|
||||
// this.loading = false;
|
||||
// this.$message.warning("config.autocompleteKey格式有误");
|
||||
// return;
|
||||
// }
|
||||
let params = {};
|
||||
if (type.includes("Object")) {
|
||||
params[this.config.autocompleteKey.key] = query;
|
||||
params["enableMark"] = this.config.autocompleteKey.enableMark;
|
||||
}
|
||||
if (type.includes("String")) {
|
||||
if (
|
||||
type.includes("String") ||
|
||||
type.includes("Undefined") ||
|
||||
type.includes("Null")
|
||||
) {
|
||||
// 接口为get类型时需将autocompleteKey值设为空
|
||||
console.log();
|
||||
this.config.autocompleteKey
|
||||
? (params[this.config.autocompleteKey] = query)
|
||||
: (params["queryTypeGet"] = query);
|
||||
: (params = query);
|
||||
}
|
||||
this.config.serveTarget(params).then((res) => {
|
||||
let timeInstance = setTimeout(() => {
|
||||
this.loading = false;
|
||||
clearTimeout(timeInstance);
|
||||
if (res.data.length) {
|
||||
this.list = res.data;
|
||||
} else this.list = [];
|
||||
}, 1000 * Math.random());
|
||||
this.loading = false;
|
||||
if (res.data.length) {
|
||||
this.list = res.data;
|
||||
} else this.list = [];
|
||||
});
|
||||
} else {
|
||||
this.list = [];
|
||||
|
||||
Reference in New Issue
Block a user