1.输入框写入@focus.Native="focus($event)"事件
<input @focus.Native="focus($event)" v-model="phone" type="number" placeholder="请输入手机号" @input="phoneInput">
2.
// 设置手机输入框(点击输入顶上去)
focus(ev){
this.scrollIntoView(ev.target);
},
//点击输入顶上去
scrollIntoView(target){
const u = navigator.userAgent;
const isiOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
let facility = isiOS?true:false;
if(!facility){
setTimeout(()=>{
target.scrollIntoView()
},500)
}
},