欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決vue js IOS H5focus無(wú)法自動(dòng)彈出鍵盤的問(wèn)題

 更新時(shí)間:2018年08月30日 10:36:36   作者:lizhen_software  
今天小編就為大家分享一篇解決vue js IOS H5focus無(wú)法自動(dòng)彈出鍵盤的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

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

代碼如下,有問(wèn)題歡迎評(píng)論

<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)
    // 表示字符串中某個(gè)位置的數(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無(wú)法自動(dòng)彈出鍵盤的問(wèn)題就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

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

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

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

    詳解Vue Cli瀏覽器兼容性實(shí)踐

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

    iview同時(shí)驗(yàn)證多個(gè)表單問(wèn)題總結(jié)

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

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

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

    vuex新手進(jìn)階篇之改變state?mutations的使用

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

    vue項(xiàng)目及axios請(qǐng)求獲取數(shù)據(jù)方式

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

    html2canvas使用文檔(vue舉例)

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

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

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

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

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

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

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

最新評(píng)論