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

vue實現(xiàn)鍵盤輸入支付密碼功能

 更新時間:2018年08月18日 16:31:48   作者:劍子  
這篇文章主要為大家詳細(xì)介紹了vue實現(xiàn)鍵盤輸入支付密碼功能,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了vue實現(xiàn)鍵盤輸入支付密碼功能的具體代碼,供大家參考,具體內(nèi)容如下

支付密碼功能界面如下圖:

主要代碼如下:

<template>
 <div class="pay-tool">
  <div class="pay-tool-title border-bottom">
   <span class="icon icon-back" @click="backHandle"></span><strong>請輸入交易密碼</strong>
  </div>
  <div class="pay-tool-content">
   <div class="pay-tool-inputs">
    <div class="item" v-for="i in items"><span class="icon_dot" v-if="password[i]"></span></div>
   </div>
   <div class="pay-tool-link"><router-link class="link" to="/getP">忘記密碼?</router-link></div>
  </div>
  <div class="pay-tool-keyboard">
   <ul>
    <li @click="keyUpHandle($event)" v-for="val in keys">
     {{ val }}
    </li>
    <li class="del" @click="delHandle"><span class="icon-del"><</span></li>
   </ul>
  </div>
 </div>
</template>

<script>
 const keys = () => [1, 2, 3, 4, 5, 6, 7, 8, 9, '', 0]
 // let sendFlag = true // 防止重復(fù)發(fā)送密碼
 export default {
  data () {
   return {
    items: [0, 1, 2, 3, 4, 5],
    keys: keys(),
    password: []
   }
  },
  methods: {
   backHandle () {
    this.clearPasswordHandle() // 返回時清除password
    this.$emit('backFnc') // 返回上級
   },
   keyUpHandle (e) {
    let text = e.currentTarget.innerText
    let len = this.password.length
    if (!text || len >= 6) return
    this.password.push(text)
    this.ajaxData()
   },
   delHandle () {
    if (this.password.length <= 0) return false
    this.password.shift()
   },
   ajaxData () {
    if (this.password.length >= 6) {
     console.log(parseInt(this.password.join(' ').replace(/\s/g, '')))
    }
    return false
   },
   clearPasswordHandle: function () {
    this.password = []
   }
  }
 }
</script>

<style lang="less" scoped>
 .pay-tool {
  position: relative;
  height: 18.93333333rem;
  background-color: #fff;
  overflow: hidden;
  &-title {
   width: 100%;
   height: 2.08888888rem;
   padding: 0 0.8rem;
   line-height: 2.08888888rem;
   text-align: center;
   overflow: hidden;
   .icon {
    float: left;
    margin-top: 0.72222222rem;
   }
   strong {
    font-size: 0.8rem;
   }
  }
  &-content {
   .pay-tool-inputs {
    width: 14.46666666rem;
    height: 2.31111111rem;
    margin: 1.28888888rem auto 0;
    border: 1px solid #b9b9b9;
    border-radius: 0.26666666rem;
    box-shadow: 0 0 1px #e6e6e6;
    display: flex;
    .item {
     width: 16.66666666%;
     height: 2.31111111rem;
     border-right: 1px solid #b9b9b9;
     line-height: 2.31111111rem;
     text-align: center;
     &:last-child {
      border-right: none;
     }
     .icon_dot {
      display: inline-block;
      width: 0.51111111rem;
      height: 0.51111111rem;
      background: url("../../assets/images/icon_dot.png") no-repeat;
      background-size: cover;
     }
    }
   }
   .pay-tool-link {
    padding: 0.53333333rem 0.8rem 0;
    text-align: right;
    .link {
     font-size: 0.66666666rem;
     color: #3c8cfb;
    }
   }
  }
  .pay-tool-keyboard {
   position: absolute;
   left: 0;
   bottom: 0;
   width: 100%;
   ul {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    li {
     width: 33.3333%;
     height: 2.25442834rem;
     line-height: 2.25442834rem;
     text-align: center;
     border-right: 1px solid #aeaeae;
     border-bottom: 1px solid #aeaeae;
     font-size: 0.8rem;
     font-weight: bold;
     &:nth-child(1), &:nth-child(2), &:nth-child(3) {
      border-top: 1px solid #eee;
     }
     &:nth-child(3), &:nth-child(6), &:nth-child(9), &:nth-child(12) {
      border-right: none;
     }
     &:nth-child(10), &:nth-child(11), &:nth-child(12) {
      border-bottom: none;
     }
     &:nth-child(10), &:nth-child(12), &:active {
      background-color: #d1d4dd;
     }
     &:nth-child(12):active {
      background-color: #fff;
     }
    }
   }
  }
 }
</style>

注意:頁面使用rem布局,根html的font-size為45px。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Vue?監(jiān)視屬性之天氣案例實現(xiàn)

    Vue?監(jiān)視屬性之天氣案例實現(xiàn)

    這篇文章主要介紹了Vue?監(jiān)視屬性之天氣案例實現(xiàn),文章以天氣為例展開介紹Vue?監(jiān)視屬性?的相關(guān)內(nèi)容,需要的小伙伴可以參考一下
    2022-05-05
  • Vue使用mockjs問題(返回數(shù)據(jù)、get、post 請求)

    Vue使用mockjs問題(返回數(shù)據(jù)、get、post 請求)

    這篇文章主要介紹了Vue使用mockjs問題(返回數(shù)據(jù)、get、post 請求),具有很好的參考價值,希望對大家有所幫助。
    2023-05-05
  • Vue下拉框雙向聯(lián)動效果的示例代碼

    Vue下拉框雙向聯(lián)動效果的示例代碼

    這篇文章主要介紹了Vue下拉框雙向聯(lián)動效果,實現(xiàn)聯(lián)動,大家都知道在vue的頁面中,想要實現(xiàn)多個<el-select 下拉框的值動態(tài)改變,必須要調(diào)用@change 函數(shù),具體操作方法跟隨小編一起學(xué)習(xí)下吧
    2022-04-04
  • Vue高性能列表GridList組件及實現(xiàn)思路詳解

    Vue高性能列表GridList組件及實現(xiàn)思路詳解

    這篇文章主要為大家介紹了Vue高性能列表GridList組件及實現(xiàn)思路詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-11-11
  • web前端vue實現(xiàn)插值文本和輸出原始html

    web前端vue實現(xiàn)插值文本和輸出原始html

    這篇文章主要介紹了web前端vue實現(xiàn)插值文本和輸出原始html,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-01-01
  • vue中使用ts配置的具體步驟

    vue中使用ts配置的具體步驟

    這篇文章主要介紹了vue中使用ts配置的具體步驟,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • vue axios數(shù)據(jù)請求get、post方法及實例詳解

    vue axios數(shù)據(jù)請求get、post方法及實例詳解

    axios是一個基于Promise,同時支持瀏覽器端和Node.js的HTTP庫,常用于Ajax請求。這篇文章主要介紹了vue axios數(shù)據(jù)請求get、post方法的使用 ,需要的朋友可以參考下
    2018-09-09
  • vue獲取參數(shù)的幾種方式總結(jié)

    vue獲取參數(shù)的幾種方式總結(jié)

    這篇文章主要介紹了vue獲取參數(shù)的幾種方式總結(jié),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • vue實現(xiàn)靜態(tài)頁面點贊和取消點贊功能

    vue實現(xiàn)靜態(tài)頁面點贊和取消點贊功能

    這篇文章主要為大家詳細(xì)介紹了vue實現(xiàn)靜態(tài)頁面點贊和取消點贊的功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • Vue實現(xiàn)數(shù)據(jù)請求攔截

    Vue實現(xiàn)數(shù)據(jù)請求攔截

    這篇文章主要為大家詳細(xì)介紹了Vue實現(xiàn)數(shù)據(jù)請求攔截,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-10-10

最新評論