This commit is contained in:
xiaozhiyong
2023-02-21 13:47:04 +08:00
parent 96233ead10
commit 955ab6840c
8 changed files with 164 additions and 197 deletions

View File

@@ -1,14 +1,4 @@
<template>
<!-- <el-autocomplete
v-model="text"
:fetch-suggestions="querySearchAsync"
:value-key="config.valueKey"
:placeholder="config.placeholder"
clearable
@select="selectAutocomplete"
@clear="params[config.querykey] = ''"
></el-autocomplete> -->
<el-select
v-model="params[config.querykey]"
filterable
@@ -18,6 +8,7 @@
:placeholder="config.placeholder"
:remote-method="remoteMethod"
@clear="list = []"
:disabled="isDisabled"
>
<el-option
v-for="(item, index) in list"
@@ -46,15 +37,16 @@ export default {
return {
text: "",
list: [],
isDisabled: false,
};
},
watch: {
"config.echoId": {
handler(nval, oval) {
if (nval) {
console.log(nval);
this.remoteMethod(this.config.echoName);
}
this.isDisabled = !!this.config.isDisabled;
},
deep: true,
immediate: true,
@@ -82,23 +74,6 @@ export default {
this.list = [];
}
},
// querySearchAsync(queryString, cb) {
// if (queryString) {
// let params = {};
// params[this.config.autocompleteKey] = queryString;
// this.config.serveTarget(params).then((res) => {
// let timeInstance = setTimeout(() => {
// clearTimeout(timeInstance);
// if (res.data.length) {
// cb(res.data);
// } else cb([]);
// }, 1000 * Math.random());
// });
// } else cb([]);
// },
// selectAutocomplete(item) {
// this.params[this.config.querykey] = item.id;
// },
},
};
</script>