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()
  }
})
<input type="text" v-focus>
某草草
某草草

reply all(3)
为情所困

You can use autofocus="autofocus"

我想大声告诉你

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.

三叔

Do it manually...
mounted() {
xxx.focus()
}

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template