ElementUI's Select component cannot invoke the soft keyboard on IOS.

Reason: In the select component of ElementUI, if the filterable attribute is added, the actual rendering is like this:

In other words, if an additional readonly attribute is added, the readonly attribute of the input on IOS will cause the soft keyboard to fail to pop up.

Solution: Just remove the readonly attribute of the component and add the following three attributes to the select component:

Code:

ref="select"
@hook:mounted="cancalReadOnly"
@visible-change="cancalReadOnly"

Methods as below:

cancalReadOnly(value) {
       this.$nextTick(() => {
                if (!value) {
                const { select } = this.$refs;
                const input = select.$el.querySelector(".el-input__inner");
                input.removeAttribute("readonly");
                // this.$refs.select.blur();  根据tip自行判断是否添加
                }
            });
        },

In this way, you can pull up the soft keyboard on IOS, and it works in my personal test.

Guess you like

Origin blog.csdn.net/baidu_36095053/article/details/125047101