究其原因就是因为ios的延时机制,导致键盘还未唤起,就关闭键盘了。
<el-select
ref='select'
@focus="closeReadOnly"
@hook:mounted="closeReadOnly"
@visible-change="closeReadOnly"
></el-select>
js:
closeReadOnly(val) {
this.$nextTick(() => {
if (!val) {
const input = this.$refs.search.$el.querySelector('.el-input__inner')
const timer = setTimeout(() => {
input.removeAttribute('readonly')
clearTimeout(timer)
}, 200)
}
})
}