服装网站建设公司/锦州seo推广

服装网站建设公司,锦州seo推广,深圳网络推广培训学校,甜点网站要怎么做哈喽,大家好,最近鹏仔开发的项目是学校校内车辆超速方面的统计检测方面的系统,在开发过程中发现有个小功能,就是用户移动端添加车牌号,刚开始想着就一个输入框,提交时正则效验一下格式就行,最后…

哈喽,大家好,最近鹏仔开发的项目是学校校内车辆超速方面的统计检测方面的系统,在开发过程中发现有个小功能,就是用户移动端添加车牌号,刚开始想着就一个输入框,提交时正则效验一下格式就行,最后感觉不是很方便,所以就简单自己手写了一个H5车牌号软键盘,由于每天工作比较忙,就没封装成插件了,趁着晚上空闲,给大家整理一下demo,复制即可使用,或者自行封装一个组件调用也可以(代码中一些写法可能过于粗糙,时间有限,任务多,就粗糙写一下吧,反正功能是实现了)。

功能如上图所示,支持 8位电车车牌和7位油车车牌。

第一位是 省份,用户点击就会弹出省份软键盘;

第二位是 字母,用户点击只能输入字母;

第三、四、五、六位是字母和数字,不包含O;

第七位是 数字、字母、或者学、警之类汉字;

第八位是 电车选项。

用户点击软键盘对应的按键时会高亮,这个是后期加的,所以上图中没有展示出来。

鹏仔的移动端是rem布局,根元素是26.67vw,如果你使用,可自行根据自己的项目将css中所有的单位变化一下。

body,div,p,ul,ol,li,dl,dt,dd,table,tr,td,form,hr,h1,h2,h3,h4,h5,h6,fieldset,img,input {margin:0;padding:0}
body,html {width:100%;height:100%;font-size: 26.67vw;}

完整代码如下

<template><div class="layer"><!-- content --><div class="content-layer"><div class="my-car-layer"><!-- 添加车辆 --><div class="my-car-layer-add" @click="addShow = true"><div class="add-text"><p>添加车辆</p></div></div></div></div><!-- 添加车辆弹窗 --><div class="shade-layer" v-if="addShow" @click="keyboardShow = false"><div class="add-content"><div class="add-header"><p>车辆信息</p><span @click="addShow = false">关闭</span></div><div class="form-list"><p>车牌号:</p><div class="car-num-input"><div v-for="(item,index) in carNumList" :key="index" @click.stop="selectCarNum(index)" :class="(carIndex == index ? 'active' : '') + ' ' + (item ? 'status-key' : '')">{{ index == 0 && !item ? '省' : index == carNumList.length-1 && !item ? '新能源' : item }}</div></div></div><button class="submit-btn" @click="carSubmitBtn()" v-points>提交</button></div><!-- 车牌键盘 --><div class="keyboard-layer" v-if="keyboardShow" @click.stop=""><div class="keyboard-header"><span @click="keyboardShow = false">完成</span></div><!-- 省份键盘 --><div class="province-layer" v-if="carIndex == '0'"><span v-for="(item,index) in provinceList" :key="index" @click="keyboardBtn(item)" :class="activeKey == item ? 'active-hover' : ''">{{ item == 'del' ? '删除' : item }}</span></div><!-- 数字字母键盘 --><div class="keyboard-item" v-if="carIndex != '0'"><div v-if="carIndex != '1'"><span v-for="(item,index) in keyboardList[0]" :key="index" @click="keyboardBtn(item)" :class="activeKey == item ? 'active-hover' : ''">{{ item }}</span></div><div><span v-for="(item,index) in keyboardList[1]" :key="index" @click="keyboardBtn(item)" :class="((item == 'O' && carIndex != '1') ? 'no-btn' : '') + ' ' + (activeKey == item ? 'active-hover' : '')">{{ item }}</span></div><div><span v-for="(item,index) in keyboardList[2]" :key="index" @click="keyboardBtn(item)" :class="activeKey == item ? 'active-hover' : ''">{{ item }}</span></div><div><span v-for="(item,index) in keyboardList[3]" :key="index" @click="keyboardBtn(item)" :class="activeKey == item ? 'active-hover' : ''">{{ item == 'del' ? '删除' : item }}</span></div><div v-if="carIndex == carNumList.length-2"><span v-for="(item,index) in keyboardList[4]" :key="index" @click="keyboardBtn(item)" :class="activeKey == item ? 'active-hover' : ''">{{ item }}</span></div></div></div></div></div>
</template>
<script>
export default {name: "car",mixins: [],components: {},data() {return {addShow: false, // 添加车辆弹窗显示隐藏formData: {carNumber: ''},carNumList: ['','','','','','','',''], // 车牌号数组activeKey: '', // 键盘按键选中激活timeoutId: null, // 定时器IDcarIndex: null, // 车牌号输入光标索引keyboardShow: false, // 键盘显示/隐藏provinceList: ['京', '津', '沪', '渝', '冀', '豫', '云', '辽', '黑', '湘','皖', '鲁', '新', '苏', '浙', '赣', '鄂', '桂', '甘', '晋','蒙', '陕', '吉', '闽', '贵', '粤', '青', '藏', '川', '宁','琼', '使', '领', '学', '警', '挂', 'del'],keyboardList: [['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'],['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'O', 'P'],['A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L'],['Z', 'X', 'C', 'V', 'B', 'N', 'M', 'del'],['学','警','港','澳']]};},mounted() {},methods: {// 添加车辆carSubmitBtn(){this.formData.carNumber = '';for(let i in this.carNumList){if(this.carNumList[i] == '' && i != this.carNumList.length-1){console.log('请输入完整车牌号');return;}this.formData.carNumber += this.carNumList[i];}console.log(this.formData.carNumber)},// 点击车牌号输入selectCarNum(inx){this.carIndex = inx;if(!this.keyboardShow){this.keyboardShow = true;}},// 键盘输入keyboardBtn(val){this.activeKey = val; // 键盘按键选中激活this.activeKeyBtn(); // 键盘按键激活定时器this.carNumList[this.carIndex] = val == 'del' ? '' : val;if(val == 'del' && this.carIndex > 0){this.carIndex--;}if(val != 'del' && this.carIndex < this.carNumList.length-1){this.carIndex++;}this.$forceUpdate();},// 键盘按键激活定时器activeKeyBtn() {// 清除之前的定时器if (this.timeoutId) clearTimeout(this.timeoutId)// 1秒后重置状态this.timeoutId = setTimeout(() => {this.activeKey = '';}, 300)}},watch: {"addShow"(){// 关闭弹窗时重置if(!this.addShow){this.formData = {carNumber: ''}this.carIndex = ''; // 车牌号输入光标索引this.carNumList = ['','','','','','','','']; // 车牌号数组this.keyboardShow = false; // 车牌键盘隐藏}}},
};
</script>
<style lang="scss" scoped>
.layer {padding: 0.22rem 0 0.64rem;box-sizing: border-box;.content-layer {width: 100%;position: relative;padding: 0 0.16rem;box-sizing: border-box;.my-car-layer{width: 100%;.my-car-layer-add{width: 100%;padding: 0.14rem 0.16rem;box-sizing: border-box;border-radius: 0.08rem;background: #FFF;display: flex;flex-direction: column;align-items: center;justify-content: center;.add-text{width: 100%;display: flex;align-items: center;justify-content: center;padding-top: 0.04rem;box-sizing: border-box;p{color: #2E59FD;font-family: "PingFang SC";font-size: 0.14rem;font-weight: 700;line-height: 0.2rem;}}}}}.shade-layer{position: fixed;top: 0;left: 0;z-index: 5;width: 100%;height: 100%;background: rgba(0,0,0,.4);padding: 0.16rem;box-sizing: border-box;display: flex;align-items: center;justify-content: center;.add-content{width: 100%;padding: 0.16rem 0.16rem 0.24rem;box-sizing: border-box;border-radius: 0.16rem;background: #FFF;.add-header{width: 100%;display: flex;align-items: center;justify-content: space-between;padding-bottom: 0.14rem;box-sizing: border-box;p{color: #000;font-family: "PingFang SC";font-size: 0.16rem;font-weight: 700;line-height: 0.22rem;}span{color: #0A61C5;font-family: "PingFang SC";font-size: 0.12rem;font-weight: 700;line-height: 0.24rem;cursor: pointer;}}.form-list{p{color: #6B7280;font-family: "PingFang SC";font-size: 0.14rem;font-weight: 500;line-height: 0.2rem;}input{display: block;font-size: 0.14rem;line-height: 0.2rem;width: 100%;border-radius: 0.08rem;border: none;background: #F5F7FA;padding: 0.12rem 0.16rem;box-sizing: border-box;}.car-num-input{width: 100%;display: flex;align-items: center;justify-content: space-between;padding: 0.04rem 0;box-sizing: border-box;div{width: 0.3rem;height: 0.36rem;background: rgba(0,0,0,.05);border-radius: 0.04rem;border: 0.01rem solid transparent;box-sizing: border-box;display: flex;align-items: center;justify-content: center;color: #000;font-size: 0.14rem;line-height: 0.18rem;&:first-child{color: rgba(0,0,0,.5);}&:last-child{border: 0.01rem dashed rgba(27, 171, 80, 0.8);color: rgba(0,0,0,.5);font-size: 0.08rem;}}.active{border: 0.01rem solid rgba(48, 112, 255, 0.8)!important;}.status-key{color: #000!important;font-size: 0.14rem!important;line-height: 0.18rem!important;}}}.submit-btn{display: block;width: 100%;border: none;padding: 0.06rem 0.1rem;box-sizing: border-box;border-radius: 0.52rem;background: linear-gradient(90deg, #0FA6F6 1.1%, #198CFE 99.99%);color: #FFF;text-align: center;font-family: "PingFang SC";font-size: 0.16rem;font-weight: 700;line-height: 0.24rem;margin-top: 0.24rem;}}.keyboard-layer{width: 100%;background: #D0D5DC;padding: 0.08rem 0.04rem 0.16rem;box-sizing: border-box;position: absolute;bottom: 0;left: 0;.keyboard-header{width: 100%;display: flex;align-items: center;justify-content: flex-end;padding: 0 0.08rem 0.08rem;box-sizing: border-box;span{color: #2E59FD;font-family: "PingFang SC";font-size: 0.14rem;font-weight: 700;line-height: 0.28rem;cursor: pointer;}}.province-layer{width: 100%;display: flex;align-items: center;justify-content: center;flex-wrap: wrap;span{color: #000;font-size: 0.14rem;line-height: 0.28rem;background: #fff;border-radius: 0.06rem;padding: 0.06rem 0.08rem;box-sizing: border-box;margin: 0.02rem;box-shadow: 0px 0.02rem 0.02rem 0px rgba(0, 0, 0, 0.1);}}.keyboard-item{width: 100%;div{display: flex;align-items: center;justify-content: center;span{color: #000;font-size: 0.14rem;line-height: 0.28rem;background: #fff;border-radius: 0.06rem;padding: 0.04rem 0.1rem;box-sizing: border-box;margin: 0.04rem;box-shadow: 0px 0.02rem 0.04rem 0px rgba(0, 0, 0, 0.3);}}}.no-btn{color: rgba(0,0,0,.4)!important;pointer-events: none;}.active-hover{background: #B3BAC7!important;}}}
}
</style>

原文:共享博客 sharedbk.comvue h5实现车牌号输入框哈喽,大家好,最近鹏仔开发的项目是学校校内车辆超速方面的统计检测方面的系统,在开发过程中发现有个小功能,就是用户移动端添加车牌号,刚开始想着就一个输入框,提交时正则效验一下格式就行,最后感觉不是很方便,所以就简单自己手写了一个H5车牌号软键盘,由于每天工作比较忙,就没封...,共享博客-(百变鹏仔)https://www.sharedbk.com/post/284.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/73398.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

硬件基础(5):(3)二极管的应用

文章目录 [toc]1. **整流电路****功能**&#xff1a;**工作原理**&#xff1a;**应用实例**&#xff1a;电路组成&#xff1a;整流过程&#xff1a;电路的应用&#xff1a; 2. **稳压电路****功能**&#xff1a;**工作原理**&#xff1a;**应用实例**&#xff1a;电路组成及功能…

ElementUI el-menu导航开启vue-router模式

有没有小伙伴遇到这么一种情况&#xff1a;ElementUI el-menu导航中&#xff0c;开启vue-router 的模式后&#xff0c;点击触发事件而不进行路由跳转&#xff1f; 别慌&#xff01;下面直接说解决方案&#xff1a; 借助路由守卫进行判断 给el-menu绑定切换事件&#xff0c;给…

Vue 2 探秘:visible 和 append-to-body 是谁的小秘密?

&#x1f680; Vue 2 探秘&#xff1a;visible 和 append-to-body 是谁的小秘密&#xff1f;&#x1f914; 父组件&#xff1a;identify-list.vue子组件&#xff1a;fake-clue-list.vue 嘿&#xff0c;各位前端探险家&#xff01;&#x1f44b; 今天我们要在 Vue 2 的代码丛林…

C++学习之路:从头搞懂配置VScode开发环境的逻辑与步骤

目录 编辑器与IDE基于vscode的C开发环境配置1. 下载vscode、浅尝编译。番外篇 2. 安装插件&#xff0c;赋能编程。3. 各种json文件的作用。c_cpp_properties.jsontask.jsonlaunch.json 总结&&彩蛋 编辑器与IDE 上一篇博客已经介绍过了C程序的一个编译流程&#xff0c;从…

PPT 转高精度图片 API 接口

PPT 转高精度图片 API 接口 文件处理 / 图片处理&#xff0c;将 PPT 文件转换为图片序列。 1. 产品功能 支持将 PPT 文件转换为高质量图片序列&#xff1b;支持 .ppt 和 .pptx 格式&#xff1b;保持原始 PPT 的布局和样式&#xff1b;转换后的图片支持永久访问&#xff1b;全…

VSCode 抽风之 两个conda环境同时在被激活

出现了神奇的(toolsZCH)(base) 提示符&#xff0c;如下图所示&#xff1a; 原因大概是&#xff1a;conda 环境的双重激活&#xff1a;可能是 conda 环境没有被正确清理或初始化&#xff0c;导致 base 和 toolsZCH 同时被激活。 解决办法就是 &#xff1a;conda deactivate 两次…

git | 回退版本 并保存当前修改到stash,在进行整合。[git checkout | git stash 等方法 ]

目录 一些常见命令&#xff1a; git 回退版本 一、临时回退&#xff08;不会修改历史&#xff0c;可随时回到当前版本&#xff09; 方法1&#xff1a;git checkout HEAD~1 问题&#xff1a;处于 detached HEAD 状态下提交的&#xff0c;无法直接 git push ✅ 选项 1&…

如何使用 Postman 进行接口测试?

使用 Postman 这一工具&#xff0c;可以轻松地进行接口测试。以下是一份简单的使用教程&#xff0c;帮助你快速上手。 Postman 接口测试教程&#xff1a;详细步骤及操作技巧

写作软件新体验:让文字创作更高效

一、开篇引入:写作难题的破解之道 在当今信息爆炸的时代,写作成为了我们生活和工作中不可或缺的一部分。然而,面对繁琐的写作任务,我们时常感到力不从心,甚至陷入创作的瓶颈。那么,有没有一款软件能够帮助我们破解这一难题,让文字创作变得更加高效和轻松呢?答案是肯定…

大模型思维链COT:Chain-of-Thought Prompting Elicits Reasoningin Large Language Models

一、TL&#xff1b;DR 探索了COT&#xff08;chain-of-thought prompting&#xff09;通过一系列的中间推理步骤来显著的提升了LLM的复杂推理能力在三个大型语言模型上的实验表明&#xff0c;思维链提示能够提升模型在一系列算术、常识和符号推理任务上的表现解释了一下为什么…

决策树算法详解:从西瓜分类到实战应用

目录 0. 引言 1. 决策树是什么&#xff1f; 1.1 生活中的决策树 1.2 专业版决策树 2. 如何构建决策树&#xff1f; 2.1 关键问题&#xff1a;选哪个特征先判断&#xff1f; 2.1.1 信息熵&#xff08;数据混乱度&#xff09; 2.1.2 信息增益&#xff08;划分后的整洁度提…

超融合服务器是什么

超融合服务器的定义与背景 超融合服务器&#xff08;Hyperconverged Infrastructure, HCI&#xff09;是一种通过软件定义技术&#xff0c;将计算、存储、网络和虚拟化功能整合到单一硬件平台中的IT基础设施解决方案。其核心目标是通过资源的高度集成和统一管理&#xff0c;简…

【网络层协议】NAT技术内网穿透

IP地址数量限制 我们知道&#xff0c;IP地址&#xff08;IPv4&#xff09;是一个4字节32位的整数&#xff0c;那么一共只有2^32也就是接近43亿个IP地址&#xff0c;而TCP/IP协议栈规定&#xff0c;每台主机只能有一个IP地址&#xff0c;这就意味着&#xff0c;一共只有不到43亿…

时隔多年,终于给它换了皮肤,并正式起了名字

时隔多年&#xff0c;终于更新了直播推流软件UI&#xff0c;并正式命名为FlashEncoder。软件仍使用MFC框架&#xff0c;重绘了所有用到的控件&#xff0c;可以有效保证软件性能&#xff0c;也便于后续进一步优化。 下载地址&#xff1a;https://download.csdn.net/download/Xi…

如何避免测试环境不稳定导致的误报

避免测试环境不稳定导致误报的核心方法包括搭建独立稳定的测试环境、使用环境监控工具、建立环境变更管理机制、定期维护更新测试环境以及提升团队的环境管理意识。 其中&#xff0c;搭建独立稳定的测试环境尤为关键。独立的测试环境能有效隔离其他环境的干扰&#xff0c;保证测…

Axure RP9教程 :轮播图(动态面板) | 头部锁定

文章目录 引言I 轮播图操作步骤在画布中添加一个动态面板设置面板状态II 头部锁定将头部区域选中,右键组合或用Ctrl+G快捷键;将组合的头部区域,右键创建动态面板;引言 动态面板的功能十分强大,比如:拥有独立的内部坐标系,有多个状态; Banner的案例中会用到动态面板多个…

Docker入门篇4:查看容器资源、查看容器详细信息、查看容器日志、查看容器内运行的进程

大家好我是木木&#xff0c;在当今快速发展的云计算与云原生时代&#xff0c;容器化技术蓬勃兴起&#xff0c;Docker 作为实现容器化的主流工具之一&#xff0c;为开发者和运维人员带来了极大的便捷 。下面我们一起开始入门第四篇&#xff1a;查看容器资源、查看容器详细信息、…

中学数学几百年重大错误:将无穷多各异假R误为R——两数集相等的必要条件

中学数学几百年重大错误&#xff1a;将无穷多各异假R误为R——两数集相等的必要条件 黄小宁 设集A&#xff5b;x&#xff5d;表A各元均由x代表&#xff0c;相应变量x的变域是A。其余类推。本人多年前公开发表的论文中有定理&#xff1a; h定理&#xff08;两数集相等的必要条…

STM32使用红外避障传感器

1.1 介绍&#xff1a; 该传感器模块对环境光适应能力强&#xff0c;其具有一对红外线发射与接收管&#xff0c;发射管发射出一定频率的红外线&#xff0c;当检测方向遇到障碍物&#xff08;反射面&#xff09;时&#xff0c;红外线反射回来被接收管接收&#xff0c;经过比较器…

python tkinter 开发蓍草占卜系统

1. 项目概述 1.1 简介 蓍草占卜是中国传统的占卜方法&#xff0c;用于演算六十四卦。本系统通过现代编程技术&#xff0c;将传统的蓍草占卜方法数字化&#xff0c;提供一个准确、便捷的占卜工具。 蓍草占卜&#xff0c;作为中国古代的一种传统占卜方法&#xff0c;承载着深厚…