vue.js - A project developed by vue. I want to automatically focus the input when the page is opened. I use the official custom instructions, but the test on the real iOS machine is invalid.
某草草2017-07-06 10:36:42
0
3
2799
Vue.directive('focus', {
// 当绑定元素插入到 DOM 中。
inserted: function (el) {
// 聚焦元素
el.focus()
}
})
According to this page, autofocus is not supported in iphone/ipad for usability reasons.
According to this article autofocus or el.focus() Due to user experience issues, Apple does not allow it to be used on iPhone/iPad. Because focus may cause the page to zoom, open the page, and suddenly zoom, the experience is too bad, and the Big Apple can't stand it.
You can use autofocus="autofocus"
According to this article
autofocus
orel.focus()
Due to user experience issues, Apple does not allow it to be used on iPhone/iPad. Becausefocus
may cause the page to zoom, open the page, and suddenly zoom, the experience is too bad, and the Big Apple can't stand it.Do it manually...
mounted() {
xxx.focus()
}