国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Vue H5 前端自定義車牌號輸入鍵盤(支持新能源)

這篇具有很好參考價值的文章主要介紹了Vue H5 前端自定義車牌號輸入鍵盤(支持新能源)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報違法"按鈕提交疑問。

項(xiàng)目介紹:

這個項(xiàng)目是基于 vue2+vant? 寫的錄入車牌的鍵盤, 有需要的伙伴可以參考一下;


先看一下效果圖:

h5車牌輸入鍵盤,vue,h5,前端,vue.js,javascript,css3,html5

?h5車牌輸入鍵盤,vue,h5,前端,vue.js,javascript,css3,html5

這個是組件的代碼,直接在頁面中引用即可,車牌號的值存在carNumber里面,在確定按鈕中,講完整的carNumber傳到引用的頁面中即可.

<template>
  <div class="keyboards">
    <div class="keyboards_title">輸入車牌<span>(綠色背景為新能源車牌)</span> </div>
    <div>
      <ul class="input_box" @click="clickShowKeyboard">
        <li >{{ first }}</li>
        <li>{{ numArr[0] }}</li><span style="font-size: .5rem;line-height: .9rem;color:#ced0d2 ;">?</span>
        <li>{{ numArr[1] }}</li>
        <li>{{ numArr[2] }}</li>
        <li>{{ numArr[3] }}</li>
        <li>{{ numArr[4] }}</li>
        <li>{{ numArr[5] }}</li>
        <li>{{ numArr[6] }}</li>
      </ul>
    </div>
    <div class="keySure" @click="submitNumber">確定</div>
    <!-- 鍵盤-中英文 -->
    <van-popup v-model="showKeyboards" position="bottom" :overlay="false" overlay-class="displayNone">
      <div class="keyboards_keys">
        <div class="finish_key"><span @click="hidekeyboards">完成</span></div>
        <div class="finish_line"></div>
        <div class="key_box">
          <!-- 中文 -->
          <div v-if="checkLangages" class="chinese">
            <ul v-for="(item, index) in chineseList" :key="index">
              <li v-for="val in item" :key="val.id" :class="{ del: val.id === 99 || val.id === 98 }" @click="chooseChinese(val)">{{
                val.name }}</li>
            </ul>
          </div>
          <!-- 數(shù)字英文 -->
          <div v-else class="english">
            <ul v-for="(item, index) in englishList" :key="index">
              <li v-for="val in item" :key="val.id" :class="{ del: val.id === 99 || val.id === 97 }" @click="chooseEnglish(val)">{{
                val.name }}</li>
            </ul>
          </div>

        </div>
      </div>
    </van-popup>
  </div>
</template>

<script>
// import { submitCarNumber } from '../../api/global'
import { Toast } from 'vant';

export default {
  data() {
    return {
      first: '',
      numArr: [],
      showKeyboards: true,
      checkLangages: true,
      chineseList: [
        [
          { name: "京", id: 1 },
          { name: "津", id: 2 },
          { name: "冀", id: 3 },
          { name: "晉", id: 4 },
          { name: "蒙", id: 5 },
          { name: "遼", id: 6 },
          { name: "吉", id: 7 },
          { name: "黑", id: 8 },
          { name: "滬", id: 9 },
          { name: "蘇", id: 10 }
        ],
        [
          { name: "浙", id: 11 },
          { name: "皖", id: 12 },
          { name: "閩", id: 13 },
          { name: "贛", id: 14 },
          { name: "魯", id: 15 },
          { name: "豫", id: 16 },
          { name: "鄂", id: 17 },
          { name: "湘", id: 18 },
          { name: "粵", id: 19 },
          { name: "桂", id: 20 },
        ],
        [
          { name: "瓊", id: 21 },
          { name: "渝", id: 22 },
          { name: "川", id: 23 },
          { name: "貴", id: 24 },
          { name: "云", id: 25 },
          { name: "藏", id: 26 },
          { name: "陜", id: 27 },
          { name: "甘", id: 28 },
          { name: "青", id: 29 },
          { name: "寧", id: 30 },
        ],
        [
          { name: 'ABC', id: 98 },
          { name: "新", id: 31 },
          { name: "使", id: 32 },
          { name: "領(lǐng)", id: 33 },
          { name: "警", id: 34 },
          { name: "學(xué)", id: 35 },
          { name: "港", id: 36 },
          { name: "澳", id: 37 },
          { name: "刪除", id: 99 }
        ]
      ],
      englishList: [
        [
          { name: "1", id: 40 },
          { name: "2", id: 41 },
          { name: "3", id: 42 },
          { name: "4", id: 43 },
          { name: "5", id: 44 },
          { name: "6", id: 45 },
          { name: "7", id: 46 },
          { name: "8", id: 47 },
          { name: "9", id: 48 },
          { name: "0", id: 49 },
        ],
        [
          { name: "Q", id: 38 },
          { name: "W", id: 39 },
          { name: "E", id: 40 },
          { name: "R", id: 41 },
          { name: "T", id: 42 },
          { name: "Y", id: 43 },
          { name: "U", id: 44 },
          { name: "I", id: 45 },
          { name: "O", id: 46 },
          { name: "P", id: 47 },
        ],
        [
          { name: "A", id: 48 },
          { name: "S", id: 49 },
          { name: "D", id: 50 },
          { name: "F", id: 51 },
          { name: "G", id: 52 },
          { name: "H", id: 53 },
          { name: "J", id: 54 },
          { name: "K", id: 55 },
          { name: "L", id: 56 },

        ],
        [
          { name: '地區(qū)', id: 97 },
          { name: "Z", id: 57 },
          { name: "X", id: 58 },
          { name: "C", id: 59 },
          { name: "V", id: 60 },
          { name: "B", id: 61 },
          { name: "N", id: 62 },
          { name: "M", id: 63 },
          { name: "刪除", id: 99 }
        ]
      ],
      carNUmber: ''
    }
  },
  methods: {
    // 喚醒鍵盤
    clickShowKeyboard() {
      this.showKeyboards = true
      if (!this.first) {
        this.checkLangages = true
      } else {
        this.checkLangages = false
      }
    },
    // 選擇車牌號前面的漢字
    chooseChinese(val) {
      if (val.id === 97 || val.id === 98) {
        this.checkLangages = !this.checkLangages
      } else if (val.id === 99) {
        if (this.numArr.length === 0) {
          this.first = "";
        }
      } else {
        // 把選中的字賦值給第一個格,并且切換鍵盤
        this.first = val.name;
        this.checkLangages = false;
      }
    },
    // 選擇車牌后面的數(shù)字和字母
    chooseEnglish(val) {
      if (val.id === 97 || val.id === 98) {
        this.checkLangages = !this.checkLangages
      } else if (val.id === 99) {
        this.numArr.pop()

        // 如果數(shù)字,字母被刪光了,則切換到中文鍵盤
        if (this.numArr.length === 0) {
          this.checkLangages = true
        }
      } else {  //把選中的值push到numArr里面
        this.numArr.push(val.name)
        if (this.numArr.length > 7) {
          this.numArr.pop()
        }
      }
      this.carNUmber = this.first + this.numArr.join('')
      console.log(this.carNUmber);
    },
    // 完成,隱藏鍵盤
    hidekeyboards() {
      this.showKeyboards = false
    },
    // 提交車牌號
    submitNumber() {
      const carNumberReg = /^[京津滬渝冀豫云遼黑湘皖魯新蘇浙贛鄂桂甘晉蒙陜吉閩貴粵青藏川寧瓊使領(lǐng)][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9掛學(xué)警港澳]$/
      if (carNumberReg.test(this.carNUmber)) {
        console.log(this.carNUmber, '確定按鈕')
        // this.show_chinese = false;
        this.showKeyboards = false;
        this.$emit('sendCarNumber', this.carNUmber)
        // 清空上一次輸入的車牌
        this.first = ''
        this.numArr = []
      } else {
        Toast('請輸入正確的車牌號');
      }
      this.first = ''
      this.numArr = []
      this.checkLangages=true
    }
  }

}
</script>
<style lang="less" scoped>
.keyboards {
  width: 100%;
  box-sizing: border-box;

  .keyboards_title {
    margin: .3rem .5rem;
    font-size: .35rem;
    span{
      margin-left: 5px;
      font-size: .3rem;
      color: #45b94d;
    }
  }

  .input_box {
    display: flex;
    justify-content: center;
    width: 6.5rem;
    height: .9rem;
    margin: 0 auto .5rem;
    box-sizing: border-box;

    li {
      flex: 1;
      border: 1px solid #ced0d2;
      border-radius: 4px;
      margin: 2px;
      text-align: center;
      line-height: .8rem;
      font-size: .45rem;
    }

    li:last-child {
      background-color: #9eefa4;
    }

    // 動態(tài)樣式
    .li_focus {
      border: 1px solid orange;
    }


  }

  .keySure {
    margin: auto;
    font-size: .4rem;
    width: 6.5rem;
    height: .9rem;
    text-align: center;
    line-height: .9rem;
    color: #fff;
    border-radius: .45rem;
    background-color: #333333;
  }

  .keyboards_keys {
    width: 7.5rem;
    margin: .2rem auto 0rem;
    // padding-bottom: .5rem;
    height: 5.7rem;
    background-color: rgb(211, 214, 221);

    .finish_key {
      width: 7.5rem;
      font-size: .3rem;
      // font-weight: 700;
      height: .6rem;
      line-height: .6rem;
      color: rgb(104, 105, 105);

      span {
        position: absolute;
        right: .38rem;
      }
    }

    .finish_line {
      width: 7.5rem;
      border-bottom: 1px solid rgb(178, 179, 180);
    }

    .key_box {
      ul {
        display: flex;
        justify-content: center;
        width: 7rem;
        height: .9rem;
        margin: .2rem auto .2rem;
        box-sizing: border-box;

        li {
          // flex: 1;
          width: .63rem;
          font-size: .35rem;
          // border: 1px solid red;
          background-color: #fff;
          border-radius: 5px;
          box-shadow: 1px 3px 1px #aaa;
          text-align: center;
          line-height: .78rem;
          margin: 2px;
          padding: 2px;
        }

        .del {
          width: .96rem;
          background-color: rgb(177, 183, 197);
        }

        .area {
          width: .9rem;
        }
      }
    }
  }
}
</style>

在頁面中引用(這邊只貼了引用部分的代碼,其他的根據(jù)自己的頁面去補(bǔ)充即可)文章來源地址http://www.zghlxwxcb.cn/news/detail-786224.html

<template>
......
  <van-popup v-model="showKeyboards" round position="bottom" :style="{ height: '72%' }">
     <Keyboards @sendCarNumber="getcrNumber"></Keyboards>
  </van-popup>
......
</template>


<script>
 import Keyboards from '../components/keybords/index.vue'  //引入組件
 export default{
 components:{Keyboards},
 methods:{
   getcrNumber(val) {
   const carNumberReg = /^[京津滬渝冀豫云遼黑湘皖魯新蘇浙贛鄂桂甘晉蒙陜吉閩貴粵青藏川寧瓊使領(lǐng)][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9掛學(xué)警港澳]$/
   if (carNumberReg.test(val)) {
     this.showKeyboards = false
     this.carNumber = val
   }
 },

}

 }


</script>

到了這里,關(guān)于Vue H5 前端自定義車牌號輸入鍵盤(支持新能源)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 微信小程序 車牌號輸入組件

    微信小程序 車牌號輸入組件

    一個小組件,用于方便用戶輸入車牌號碼 有時候我們開發(fā)過程中會遇到需要用戶輸入車牌號的情況,讓客戶通過自帶鍵盤輸入,體驗(yàn)不好且容易出錯,例如車牌號是不能輸入O和I的,因此需要有一個自定義的鍵盤,讓客戶輸入正確的車牌號 1 布局設(shè)計 2 數(shù)據(jù)設(shè)計 把合法輸入的

    2024年02月11日
    瀏覽(22)
  • 模擬生成車牌號

    任務(wù)描述 本關(guān)任務(wù):編寫一段能生成若干個車牌號的代碼 在本題中,根據(jù)如下步驟隨機(jī)生成若干個車牌號。 分行輸入隨機(jī)種子以及車牌號數(shù)量n,生成包含n個車牌號的列表并輸出。 車牌號規(guī)則: 以’鄂A-‘或’鄂W-‘開頭 長度總共為8位,后5位中包含最多2個字母字符,其余

    2024年02月16日
    瀏覽(22)
  • OpenCV實(shí)戰(zhàn)5 車牌號識別

    OpenCV實(shí)戰(zhàn)5 車牌號識別

    原文在這里,參考這個進(jìn)行了改進(jìn) 感覺學(xué)到了很多東西,便在這里作下筆記。 效果: 目錄 一、知識點(diǎn)學(xué)習(xí): 1. fstream 2. 形態(tài)學(xué)開操作與形態(tài)閉操作 2.1 第一個角度:消除較小的聯(lián)通區(qū)域 vs 彌合較小的聯(lián)通區(qū)域 2.2 第二個角度:消除背景噪音 vs 消除前景噪音 3、approPolyDp函數(shù)

    2024年02月01日
    瀏覽(20)
  • C練習(xí)——肇事卡車車牌號

    C練習(xí)——肇事卡車車牌號

    題目: 一輛卡車違反交通規(guī)則,撞人后逃跑?,F(xiàn)場有3人目擊事件,但沒有記住車牌號,只記住了車號的一些特征。 甲說:“牌照前兩位數(shù)字是相同的”,乙說:“牌照的后兩位數(shù)字是相同的,但與前兩位不同”,丙是為數(shù)學(xué)家,他說:“4位車號正好是一個整數(shù)的平方”。請

    2024年02月02日
    瀏覽(17)
  • 5.9 自選車牌號小程序(project)

    任務(wù)描述 本關(guān)任務(wù):編寫一個能隨機(jī)產(chǎn)生5個數(shù)字的車牌號的小程序。 相關(guān)知識 為了完成本關(guān)任務(wù),你需要掌握: 1.隨機(jī)產(chǎn)生一個整數(shù) 2.隨機(jī)產(chǎn)生多個整數(shù) 隨機(jī)產(chǎn)生一個整數(shù)(字符) randint(a,b) 可以產(chǎn)生[a,b]之間的一個整數(shù) random.randint(0,10)

    2024年02月08日
    瀏覽(105)
  • 告別繁瑣,ModelArts一鍵解決車牌號識別難題

    本文分享自華為云社區(qū)《基于ModelArts實(shí)現(xiàn)車輛車牌號的目標(biāo)識別》,作者:嶼山島 。 車輛車牌是車輛的唯一身份標(biāo)識,能夠提供車輛的類型、顏色、歸屬地等信息,對于交通管理、安全監(jiān)控、智能出行等領(lǐng)域具有重要的應(yīng)用價值。隨著計算機(jī)視覺技術(shù)的發(fā)展,車輛車牌的自

    2024年02月05日
    瀏覽(25)
  • opencv 車牌號的定位和識別+UI界面識別系統(tǒng)

    opencv 車牌號的定位和識別+UI界面識別系統(tǒng)

    目錄 一、實(shí)現(xiàn)和完整UI視頻效果展示 主界面: 識別結(jié)果界面:(識別車牌顏色和車牌號) 查看歷史記錄界面: 二、原理介紹: 車牌檢測-圖像灰度化-Canny邊緣檢測-膨脹與腐蝕 邊緣檢測及預(yù)處理-膨脹+腐蝕組合-再一次膨脹-車牌識別 圖像最終處理-字符分割及識別 完整演示視

    2024年02月11日
    瀏覽(98)
  • 車輛信息快速查找API:輕松查詢車牌號對應(yīng)車輛的詳細(xì)資料

    車輛信息快速查找API:輕松查詢車牌號對應(yīng)車輛的詳細(xì)資料

    ? 車輛信息的快速查找對于許多人來說是非常有用的。無論是想要購買一輛二手車,還是需要了解某輛車的詳細(xì)信息,這個需求在現(xiàn)實(shí)生活中經(jīng)常會遇到。那么,有沒有一種快速方便的方法來實(shí)現(xiàn)這個功能呢?答案是有的,就是通過車輛信息快速查找API。 在這篇博文中,我們

    2024年03月24日
    瀏覽(33)
  • 深度學(xué)習(xí)實(shí)戰(zhàn)項(xiàng)目(一)-基于cnn和opencv的車牌號識別

    深度學(xué)習(xí)實(shí)戰(zhàn)項(xiàng)目(一)-基于cnn和opencv的車牌號識別

    網(wǎng)上大部分是關(guān)于tensorflow,使用pytorch的比較少,本文也在之前大佬寫的代碼的基礎(chǔ)上,進(jìn)行了數(shù)據(jù)集的完善,和代碼的優(yōu)化,效果可比之前的pytorch版本好一點(diǎn)。 數(shù)據(jù)集來自github開源的字符數(shù)據(jù)集: 數(shù)據(jù)集有:0-9,26個字母減去I和O,還有中文字,這里可以看看幾張圖片:

    2024年02月06日
    瀏覽(26)
  • 前端Vue自定義支付密碼輸入鍵盤Keyboard和支付設(shè)置輸入框Input

    前端Vue自定義支付密碼輸入鍵盤Keyboard和支付設(shè)置輸入框Input

    前端Vue自定義支付密碼輸入鍵盤Keyboard和支付設(shè)置輸入框Input, 閱讀全文下載完整代碼請關(guān)注微信公眾號: 前端組件開發(fā) 效果圖如下: 使用方法 HTML代碼實(shí)現(xiàn)部分

    2024年02月10日
    瀏覽(33)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包