el-select 再添加 filterable属性支持输入搜索时,在ios上无法拉起键盘
解决
<el-select
ref="selectRef"
v-model="item.appId"
clearable
:filter-method="searchAppName"
filterable
placeholder="请输入产品"
@hoot="setFocus"
@visible-change="setFocus"
>
js
import { reactive, ref, nextTick, onMounted } from 'vue'
const selectRef = ref(null)
const { proxy } = getCurrentInstance() //获取全局
setFocus: (value) => {
nextTick(() => {
if (!value) {
setTimeout(() => {
viewsOperate.delRead()
}, 700)
}
})
},
delRead: () => {
const { selectRef } = proxy.$refs
console.log(selectRef[0])
if (selectRef[0]) {
const input = selectRef[0].$el.querySelector('.el-input__inner') //这里需要打印出dom元素才算正常,如果拿不到使用原生的 document.getElementById
if (input) {
console.log(input)
input.removeAttribute('readonly')
}
}
},