Vue前端实现输入框过滤可选项的过滤效果

it2023-11-10  80

<el-form-item label="开户支行:" prop="branchName"> <el-autocomplete v-model="form.branchName" popper-class="my-autocomplete" :fetch-suggestions="queryBranchSearch" value-key="branchName" placeholder="请输入内容" style="width: 100%;" clearable :disabled="reviewFlag" @select="handleBranchSelect" > <template slot-scope="{ item }"> <div class="name" :title="item.branchName">{{ item.branchName }}</div> </template> </el-autocomplete> </el-form-item> queryBranchSearch(queryString, cb) { var results = queryString ? this.bankBranchList.filter((provinceCity) => provinceCity.branchName.toLowerCase().match(queryString.toLowerCase()) !== null) : this.bankBranchList; // 调用 callback 返回建议列表的数据 clearTimeout(this.timeout); this.timeout = setTimeout(() => { cb(results); }, 600); }, handleBranchSelect(item) { this.form.branchNo = item.branchId || ''; },
最新回复(0)