Vueフロントエンドは入力ボックスフィルタリングオプションのフィルタリング効果を実現します

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

おすすめ

転載: blog.csdn.net/wangleisuiqiansuiyue/article/details/109191701
おすすめ