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

使用Vue實現(xiàn)簡易的車牌輸入鍵盤

 更新時間:2023年11月28日 11:08:29   作者:大陽光男孩  
這篇文章主要為大家詳細介紹了如何使用Vue實現(xiàn)簡易的車牌輸入鍵盤效果,文中的示例代碼講解詳細,具有一定的學習價值,感興趣的小伙伴可以了解下

效果圖如下:

代碼如下:

<template>
  <div>
    <div class="carNoBoxInput">
      <div style="padding: 6px;border: 2px solid #fff;border-radius: 6px;margin: 6px 3px 6px 6px;">
        <input class="inputBox" :value="licensePlateUnit[0]" @click="licensePlateDoor = true"/>
        <input class="inputBox" :value="licensePlateUnit[1]" @click="licensePlateDoor = true"/>
        <span class="dot"></span>
        <input class="inputBox" :value="licensePlateUnit[2]" @click="licensePlateDoor = true"/>
        <input class="inputBox" :value="licensePlateUnit[3]" @click="licensePlateDoor = true"/>
        <input class="inputBox" :value="licensePlateUnit[4]" @click="licensePlateDoor = true"/>
        <input class="inputBox" :value="licensePlateUnit[5]" @click="licensePlateDoor = true"/>
        <input class="inputBox" :value="licensePlateUnit[6]" @click="licensePlateDoor = true"/>
        <input v-if="7 === licensePlateUnit.length - 1" class="inputBox" :class="7 === licensePlateUnit.length - 1 ? 'inputBoxActive' : 'inputBox'" :value="licensePlateUnit[7]"/>
        <img v-if="7 !== licensePlateUnit.length - 1" src="../assets/newEnergy.png" style="height: 36px;width: 36px;"  alt="新能源"/>
      </div>
    </div>
    <div v-if="licensePlateDoor">
      <div v-if="licensePlateUnit.length < 1" class="carNoBox">
        <span class="carNo" v-for="item in columns" :key="item" @click="pickOn(item)">
          {{item}}
        </span>
        <span class="delBt" @click="delCarNo">X</span>
      </div>
      <div v-if="licensePlateUnit.length >= 1" class="carNoBox">
      <span class="carNo" v-for="item in numberColumns" :key="item" @click="pickOn(item)">
        {{item}}
      </span>
        <div style="display: flex;align-items: center">
          <span class="delBt" @click="delCarNo">X</span>
          <span class="delBt" style="margin-left: 6px;width: 42px" @click="confirm">確認</span>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
 
 
 
export default {
  data() {
    return {
      licensePlateDoor: false,
      activeIndex: 0,
      licensePlateUnit: [],
      columns: [//省縮寫選擇
        '京', '滬', '鄂', '湘', '川', '渝', '粵', '閩', '晉', '黑',
 
        '津', '浙', '豫', '贛', '貴', '青', '瓊', '寧', '吉', '蒙',
 
        '冀', '蘇', '皖', '桂', '云', '陜', '甘', '藏', '新', '遼',
        '魯'],
      numberColumns: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0','Q', 'W', 'E',
        'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z',
        'X', 'C', 'V', 'B', 'N', 'M', '港','澳','學','領','警'
      ],
    }
  },
  methods: {
    pickOn(value) {
      this.licensePlateDoor = true;
      if (this.licensePlateUnit.length <= 7) {
        this.licensePlateUnit.push(value)
      }
    },
    delCarNo() {
      this.licensePlateUnit.pop();
    },
    confirm() {
      if(this.licensePlateUnit.length >= 7) {
        console.log("車牌是:"+this.licensePlateUnit.join(''));
        this.licensePlateDoor = false;
      }
    },
  }
}
</script>
 
 
<style scoped>
  .carNo {
    border-radius: 6px;
    background: #fff;
    font-weight: bold;
    font-size: 20px;
    height: 28px;
    width:28px;
    margin: 6px;
    padding: 12px;
    cursor: pointer;
  }
  .inputBox {
    color: white;
    height: 30px;
    line-height: 30px;
    width: 30px;
    font-size: 28px;
    text-align: center;
    background-color: transparent;
    border: none;
    outline: none;
    caret-color: rgba(0, 0, 0, 0)
  }
  input:focus {
    border-bottom: 3px solid #fff;
    transition: all 0.5s;
  }
  .dot {
    margin-bottom: 6px;
    background-color: #fff;
    height: 6px;
    width: 6px;
    border-radius: 50%;
    display: inline-block
  }
  .delBt {
    background: #ACB3BB;
    border-radius: 6px;
    display: inline-block;
    font-weight: bold;
    font-size: 20px;
    height: 28px;
    width:28px;
    margin: 6px;
    padding: 12px;
    cursor: pointer;
  }
  .carNoBoxInput {
    display: flex;
    width: 310px;
    align-items: center;
    //height: 80px;
    border-radius: 8px;
    margin: 12px 0;
    background: #2D66D8;
  }
  .carNoBox {
    background: #D0D5D9;
    position: relative;
    width: 600px;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    justify-items: center;
    align-items: center
  }
</style>

到此這篇關(guān)于使用Vue實現(xiàn)簡易的車牌輸入鍵盤的文章就介紹到這了,更多相關(guān)Vue車牌輸入鍵盤內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • vue實現(xiàn)echarts餅圖/柱狀圖點擊事件實例

    vue實現(xiàn)echarts餅圖/柱狀圖點擊事件實例

    echarts原生提供了相應的API,只需要在配置好echarts之后綁定相應的事件即可,下面這篇文章主要給大家介紹了關(guān)于vue實現(xiàn)echarts餅圖/柱狀圖點擊事件的相關(guān)資料,需要的朋友可以參考下
    2023-06-06
  • vue通過?API?監(jiān)聽數(shù)組的變化

    vue通過?API?監(jiān)聽數(shù)組的變化

    這篇文章主要介紹了vue通過?API?監(jiān)聽數(shù)組的變化,在?Vue?中,你可以通過監(jiān)聽數(shù)組的變化來更新界面,Vue?提供了一些特殊的語法以及?API?來實現(xiàn)對數(shù)組的監(jiān)聽,本文通過實例代碼介紹的非常詳細,需要的朋友可以參考下
    2023-05-05
  • 在Vue中使用動態(tài)import()語法動態(tài)加載組件

    在Vue中使用動態(tài)import()語法動態(tài)加載組件

    在Vue中,你可以使用動態(tài)import()語法來動態(tài)加載組件,動態(tài)導入允許你在需要時異步加載組件,這樣可以提高應用程序的初始加載性能,本文給大家介紹在Vue中使用動態(tài)import()語法動態(tài)加載組件,感興趣的朋友一起看看吧
    2023-11-11
  • 快速解決Vue項目在IE瀏覽器中顯示空白的問題

    快速解決Vue項目在IE瀏覽器中顯示空白的問題

    今天小編就為大家分享一篇快速解決Vue項目在IE瀏覽器中顯示空白的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-09-09
  • vue中tinymce的使用實例詳解

    vue中tinymce的使用實例詳解

    TinyMCE Vue是TinyMCE官方發(fā)布的Vue組件,可以更輕松地在Vue應用程序中使用TinyMCE,這篇文章主要介紹了vue中tinymce的使用,需要的朋友可以參考下
    2022-11-11
  • vue頁面監(jiān)聽是否置為后臺或可見狀態(tài)問題

    vue頁面監(jiān)聽是否置為后臺或可見狀態(tài)問題

    這篇文章主要介紹了vue頁面監(jiān)聽是否置為后臺或可見狀態(tài)問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-10-10
  • Vue多環(huán)境代理配置方法思路詳解

    Vue多環(huán)境代理配置方法思路詳解

    多人協(xié)作模式下,修改代理比較麻煩,而且很容易某個開發(fā)人員會修改了vue.config.js文件后提交了。接下來通過本文給大家分享Vue多環(huán)境代理配置方法思路詳解,需要的朋友可以參考下
    2019-06-06
  • Vue3+Canvas實現(xiàn)簡易的貪吃蛇游戲

    Vue3+Canvas實現(xiàn)簡易的貪吃蛇游戲

    貪吃蛇作為一個經(jīng)典的小游戲,是很多人兒時的記憶,當時的掌機、諾基亞手機里面都有它的身影。本文將用Vue3?Canvas來復刻一下這款游戲,感興趣的可以了解一下
    2022-07-07
  • vue中添加音頻和視頻的示例詳解

    vue中添加音頻和視頻的示例詳解

    這篇文章主要為大家詳細介紹了如何vue中添加音頻和視頻的相關(guān)知識,文中的示例代碼簡潔易懂,具有一定的學習價值,感興趣的小伙伴可以了解下
    2023-08-08
  • vue3集成electron的過程

    vue3集成electron的過程

    本文詳細介紹了如何在Vue3項目中集成Electron,包括安裝electron和electron-builder兩個依賴,以及配置.npmrc文件和手動修改鏡像源的方法,整個過程詳細記錄了從創(chuàng)建項目、安裝依賴、修改配置、到最終打包部署的每一步
    2024-10-10

最新評論