亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

解決vue js IOS H5focus無法自動彈出鍵盤的問題

 更新時間:2018年08月30日 10:36:36   作者:lizhen_software  
今天小編就為大家分享一篇解決vue js IOS H5focus無法自動彈出鍵盤的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

IOS不自動彈出鍵盤,必須手動觸發(fā)一下focus才行,不能自動調(diào)用,所以需要誘導(dǎo)用戶點擊某個按鈕觸發(fā)focus,最終修改的方法,默認(rèn)隱藏密碼輸入框,隱藏不能用v-if或者是v-show,用position:absolute, top:-1000,然后點擊輸入密碼將top改為視窗內(nèi),并且調(diào)用focus的方法

代碼如下,有問題歡迎評論

<template>
 <div class="pwdpush-box">
  <h4 class="enter-password" @click="enterPwd">輸入密碼</h4>
  <div class="phonenum-show" :class="pushShow?'':'write-phonenum-1000'">
   <div class="write-phonenum">
    <p @click.prevent="pushShow = false">使用余額支付 8864</p>
    <p>支付密碼:</p>
    <ul class="write-input clearfix">
     <input type="tel" ref="input" maxlength="6" class="realInput" v-model="realInput" autofocus @keyup="getNum()" v-focus @keydown="delNum()">
     <li v-for="disInput in disInputs"><input type="tel" maxlength="1" disabled v-model="disInput.value"></li>
    </ul>
    <mt-button size="large" style="margin-top:80px;" @click="goPay">確認(rèn)支付</mt-button>
   </div>
  </div>
 </div>
</template>

<script>
import { Field,Toast ,Indicator} from 'mint-ui';
import {headerNav,bottomShow} from '../../vuex/actions/actionDoc'
export default {
 name: 'packe',
 vuex: {
  actions:{
   headerNav,
   bottomShow
  }
 },
 data(){
  return{
   messagepacket:false,
   packets:[

   ],
   disInputs:[{value:''},{value:''},{value:''},{value:''},{value:''},{value:''}],
   realInput:'',
   pushShow:false

  }
 },
 mounted(){
  this.headerNav(false)
  this.bottomShow(false)
 },
 methods:{
  getNum(){
   for(var i=0;i<this.realInput.length;i++){
    this.disInputs[i].value=this.realInput.charAt(i)
    // 表示字符串中某個位置的數(shù)字,即字符在字符串中的下標(biāo)。
   }
  },
  delNum(){
   var oEvent = window.event;
   if (oEvent.keyCode == 8) {
    if(this.realInput.length>0){
     this.disInputs[this.realInput.length-1].value=''
    }
   }
  },
  goPay(){
    console.log(this.realInput)
  },
  enterPwd(){
    this.pushShow = true;
    this.$refs.input.focus()
  }
 }
}
</script>
<style lang="less" sconed>
 .enter-password{
  text-align: right;
  color:#1D890D;
  font-size: 18px;
  line-height: 2;
  margin-top:20px;
  padding-right: 20px;
 }
 .phonenum-show{
  background: rgba(0,0,0,0.6);
  position: absolute;
  top:0;
  right:0;
  bottom:0;
  left:0;
  z-index: -1;
 }
 .getback-title span{position: absolute;right:0;top:3px;width:15px;height:15px;display: inline-block;}
 .write-phonenum-1000{
  top:-1000px!important;
 }
 .write-phonenum{
  position: absolute;
  top:50%;
  margin-top:-100px;
  left:0;
  right:0;
  bottom:0;
  z-index: 2;
  padding:30px 10px 0;
  background: #fff;
 }
 .write-phonenum p{
  font-size: 14px;
  margin-left:30px;
  line-height:2;
 }
 .write-phonenum p span{color: #3b90d1;}
 .write-input {width:312px; margin:10px auto; position: relative;}
 .write-input li{float: left;width:30px;height:30px; margin: 0 10px; border:1px solid #888888;}
 .write-input li input{-webkit-appearance: none;-moz-appearance: none;-ms-appearance: none;resize: none;outline: none;border:0;width:30px;line-height: 30px;text-align: center;height: 30px;font-size:16px;}
 .write-phonenum .mint-button--default{background: #3b90d1;color:#fff;font-family: "微軟雅黑";font-size: 14px;width:80%;margin:10px auto;}
 .realInput{
  /* Keyword values */
  -webkit-appearance: none;
  -moz-appearance: none;
  -ms-appearance: none;
  resize: none;
  outline: none;
  border: 0;
  z-index: 3;
  position: absolute;
  width: 290px;
  height: 30px;
  line-height: 30px;
  background: none;
  display: block;
  left: 50%;
  margin-left: -145px;
  top: 34px;
  opacity: 0;
  font-size: 0px;
  caret-color: #fff;
  color: #000;
  text-indent: -5em;
  font-size: 30px;
  top:1px;
 }
 input[type="tel"]:disabled{background-color: #fff;}
</style>

以上這篇解決vue js IOS H5focus無法自動彈出鍵盤的問題就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue源碼之批量異步更新策略的深入解析

    vue源碼之批量異步更新策略的深入解析

    這篇文章主要給大家介紹了關(guān)于vue源碼之批量異步更新策略的相關(guān)資料,關(guān)于vue異步更新是我們?nèi)粘i_發(fā)中經(jīng)常遇到的一個功能,需要的朋友可以參考下
    2021-05-05
  • 詳解Vue Cli瀏覽器兼容性實踐

    詳解Vue Cli瀏覽器兼容性實踐

    這篇文章主要介紹了詳解Vue Cli瀏覽器兼容性實踐,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-06-06
  • iview同時驗證多個表單問題總結(jié)

    iview同時驗證多個表單問題總結(jié)

    這篇文章主要介紹了iview同時驗證多個表單問題總結(jié),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-09-09
  • vue 父組件獲取子組件里面的data數(shù)據(jù)(實現(xiàn)步驟)

    vue 父組件獲取子組件里面的data數(shù)據(jù)(實現(xiàn)步驟)

    在Vue中,父組件可以通過`ref`引用子組件,并通過`$refs`屬性來訪問子組件的數(shù)據(jù),下面分步驟給大家介紹vue 父組件獲取子組件里面的data數(shù)據(jù),感興趣的朋友一起看看吧
    2024-06-06
  • vuex新手進階篇之改變state?mutations的使用

    vuex新手進階篇之改變state?mutations的使用

    在vue的項目中不可避免的會使用到vuex用于數(shù)據(jù)的存儲,下面這篇文章主要給大家介紹了關(guān)于vuex新手進階篇之改變state?mutations的使用,文中通過圖文以及實例代碼介紹的非常詳細,需要的朋友可以參考下
    2022-10-10
  • vue項目及axios請求獲取數(shù)據(jù)方式

    vue項目及axios請求獲取數(shù)據(jù)方式

    這篇文章主要介紹了vue項目及axios請求獲取數(shù)據(jù)方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • html2canvas使用文檔(vue舉例)

    html2canvas使用文檔(vue舉例)

    html2canvas.js是一款可以在網(wǎng)頁上實現(xiàn)頁面截圖的js,它使用了html5和css3的一些新功能特性,實現(xiàn)了在客戶端對網(wǎng)頁進行截圖的功能,這篇文章主要給大家介紹了關(guān)于html2canvas使用的相關(guān)資料,需要的朋友可以參考下
    2024-03-03
  • uniapp實現(xiàn)webview頁面關(guān)閉功能的代碼示例

    uniapp實現(xiàn)webview頁面關(guān)閉功能的代碼示例

    uniapp用web-view打開一個網(wǎng)頁,網(wǎng)頁中點擊跳轉(zhuǎn)到下一層級的網(wǎng)頁,一層層深入,點擊返回鍵或者頁面上方返回按鈕只能一層層往回退,下面這篇文章主要給大家介紹了關(guān)于uniapp實現(xiàn)webview頁面關(guān)閉功能的相關(guān)資料,需要的朋友可以參考下
    2024-03-03
  • Vue判斷數(shù)組內(nèi)是否存在某一項的兩種方法

    Vue判斷數(shù)組內(nèi)是否存在某一項的兩種方法

    這篇文章主要介紹了Vue判斷數(shù)組內(nèi)是否存在某一項,今天給大家分享兩種方法,分別是findIndex()和 indexOf()方法,本文結(jié)合實例代碼給大家介紹的非常詳細,需要的朋友可以參考下
    2023-07-07
  • vue配置多頁面的實現(xiàn)方法

    vue配置多頁面的實現(xiàn)方法

    本篇文章主要介紹了vue配置多頁面的實現(xiàn)方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-05-05

最新評論