el-select设置远程搜索后在移动端的ios软键盘无法调起

发布时间 2023-09-07 11:08:57作者: sinceForever
<el-select
      ref="headerSearchSelect"
      v-model="search"
      :remote-method="querySearch"
      filterable
      default-first-option
      remote
      placeholder="请输入报表关键词"
      @change="change"
      popper-class="select-con"
      clearable
      @focus="clear"
      @hook:mounted="clear"
      @visible-change="clear"
    >
      <!-- :transfer="true"
      :popper-append-to-body="false" -->
      <svg-icon class-name="search-icon" slot="prefix" icon-class="search" />

      <el-option
        v-for="option in options"
        :key="option.path + option.label"
        :value="option.value"
        :label="option.label"
      >
        <span v-html="option.name"></span>
      </el-option>
    </el-select>
clear(async) {
      this.$nextTick(() => {
        if (!async) {
          // ios 手机有延迟问题
          setTimeout(() => {
            const { headerSearchSelect } = this.$refs;
            const input =
              headerSearchSelect.$el.querySelector('.el-input__inner');
            input.removeAttribute('readonly');
          }, 200);
        }
      });
    },