当前位置: 首页 > news >正文

肇庆网站开发公司最近重大新闻头条

肇庆网站开发公司,最近重大新闻头条,深圳网站建设 设计贝尔,做手机网站尺寸先看下效果如下&#xff1a; 动态图如下 uniapp的keyup获取不到keyCode和compositionstart&#xff0c;compositionend&#xff0c;所以需要监听input节点的keyup事件&#xff0c; 思路以及代码如下&#xff1a; 1.将每一个字符用文本框输入&#xff0c;代码如下 <view …

先看下效果如下:
在这里插入图片描述
动态图如下
在这里插入图片描述
uniapp的keyup获取不到keyCode和compositionstart,compositionend,所以需要监听input节点的keyup事件,

思路以及代码如下:
1.将每一个字符用文本框输入,代码如下

<view class="license-input"><input type="text" class="input-code code0" /><input type="text" class="input-code code1" />...
</view>

2.初始化的时候将input下的真是inputdom绑定keyup事件调用skipnext,并传入每一个input的index,同时绑定compositionstart和compositionend

mounted(){document.querySelectorAll(".input-code").forEach((el, index) => {const input = el.querySelector("input");if (index > 0) {input.disabled = true;}input.addEventListener("keyup", (event) => {this.skipnext(index, event);});input.addEventListener("compositionstart", this.inputstart);input.addEventListener("compositionend", this.inputend);});
}

3.对按键进行处理,如果当前文本框已经输入完成则跳转到下一个文本框,如果没有则停留在当前文本框,第一次输入的时候,前面的没有输入完成,则不可跳过前面的号码去输入后面的号码,当删除后则解除禁止

完整代码如下:
新建license-input.vue文件,

<template><view class="license-input"><input type="text" class="input-code code0" /><input type="text" class="input-code code1" /><span class="dian">·</span><input type="tel" class="input-code code2" /><input type="tel" class="input-code code3" /><input type="tel" class="input-code code4" /><input type="tel" class="input-code code5" /><input type="tel" class="input-code code6" /></view>
</template><script>
/***  车牌照输入* ===== 使用场景 ======* 下单页面ETC**/
export default {name: "license-input",props: {carvalue: {type: String,default: "",},},mounted() {this.setEvent();},methods: {setEvent() {const v = this.carvalue.split("");document.querySelectorAll(".input-code").forEach((el, index) => {const input = el.querySelector("input");input.value = v[index] || "";if (index > 0) {input.disabled = true;}input.addEventListener("keyup", (event) => {this.skipnext(index, event);});input.addEventListener("compositionstart", this.inputstart);input.addEventListener("compositionend", this.inputend);});this.$emit("input", this.carvalue);},getVal() {let val = "";document.querySelectorAll(".input-code").forEach((el, index) => {val += el.querySelector("input").value;});return val;},skipnext(num, e) {const keycode = e.keyCode || e.which;if (e.target.timer) {clearTimeout(e.target.timer);e.target.timer = null;}// tab,ctrl,回车,Enter等可自定排除if (keycode == 9 || keycode == 13 || keycode == 18 || keycode == 32) {return;}//删除按键if (keycode == 8) {if (num > 0 && !e.target.value) {const prevel = document.querySelector(`.code${num - 1}`).querySelector("input");//   e.target.disabled = true; // 删除后将disabled 设置为trueprevel.focus();}this.$emit("input", this.getVal());return;}if (num < 6 && !e.target.hascom) {const nextel = document.querySelector(`.code${num + 1}`).querySelector("input");// 添加延迟,防止过快输入。e.target.timer = setTimeout(() => {nextel.disabled = false;nextel.focus();}, 300);}// 只能输入一个字符if (e.target.value.length > 1 && !e.target.hascom) {e.target.value = e.target.value.substr(e.target.value.length-1, 1);}this.$emit("input", this.getVal());},inputstart(e) {e.target.hascom = true;},inputend(e) {e.target.hascom = false;},},
};
</script>
<style>...</style>

父组件使用

<license-input carvalue="浙A12345" @input="(e) => {carmodel = e}"></license-input>车牌为:{{carmodel }}import licenseInput from "@/components/license-input.vue";

文章转载自:
http://aperiodic.xtqr.cn
http://dinoflagellate.xtqr.cn
http://ontogenetic.xtqr.cn
http://neurospora.xtqr.cn
http://snobbishness.xtqr.cn
http://memorandum.xtqr.cn
http://roentgenoscopy.xtqr.cn
http://sicko.xtqr.cn
http://recomposition.xtqr.cn
http://seminate.xtqr.cn
http://inferable.xtqr.cn
http://rechristen.xtqr.cn
http://negate.xtqr.cn
http://frump.xtqr.cn
http://ahermatype.xtqr.cn
http://baseborn.xtqr.cn
http://planes.xtqr.cn
http://tenno.xtqr.cn
http://metadata.xtqr.cn
http://chitterlings.xtqr.cn
http://nonresistance.xtqr.cn
http://emblematize.xtqr.cn
http://enamored.xtqr.cn
http://fostress.xtqr.cn
http://haemorrhoid.xtqr.cn
http://ecclesiastical.xtqr.cn
http://deserter.xtqr.cn
http://recipient.xtqr.cn
http://ost.xtqr.cn
http://knightlike.xtqr.cn
http://geoelectric.xtqr.cn
http://monopolize.xtqr.cn
http://isodiaphere.xtqr.cn
http://savage.xtqr.cn
http://neuromotor.xtqr.cn
http://empiricist.xtqr.cn
http://chickling.xtqr.cn
http://inject.xtqr.cn
http://sizzard.xtqr.cn
http://withy.xtqr.cn
http://maladjustment.xtqr.cn
http://pull.xtqr.cn
http://defectiveness.xtqr.cn
http://profiteering.xtqr.cn
http://canaille.xtqr.cn
http://mizoram.xtqr.cn
http://niccolite.xtqr.cn
http://josephson.xtqr.cn
http://esoteric.xtqr.cn
http://dichroite.xtqr.cn
http://czar.xtqr.cn
http://ideologism.xtqr.cn
http://polonium.xtqr.cn
http://viron.xtqr.cn
http://weathercock.xtqr.cn
http://caught.xtqr.cn
http://yeasty.xtqr.cn
http://cultureless.xtqr.cn
http://seeable.xtqr.cn
http://birder.xtqr.cn
http://tripolitania.xtqr.cn
http://sambar.xtqr.cn
http://arcking.xtqr.cn
http://archaeological.xtqr.cn
http://jungli.xtqr.cn
http://elsewhere.xtqr.cn
http://schizomycosis.xtqr.cn
http://groupuscule.xtqr.cn
http://thusly.xtqr.cn
http://goyische.xtqr.cn
http://zygomata.xtqr.cn
http://ebullience.xtqr.cn
http://seletron.xtqr.cn
http://mycosis.xtqr.cn
http://crazyweed.xtqr.cn
http://fanfaronade.xtqr.cn
http://supraconscious.xtqr.cn
http://roadworthy.xtqr.cn
http://pioupiou.xtqr.cn
http://queasily.xtqr.cn
http://mosasaur.xtqr.cn
http://shoelace.xtqr.cn
http://tachina.xtqr.cn
http://socialise.xtqr.cn
http://lifelike.xtqr.cn
http://ceramide.xtqr.cn
http://catecheticel.xtqr.cn
http://lci.xtqr.cn
http://doggerel.xtqr.cn
http://tammany.xtqr.cn
http://cambridgeshire.xtqr.cn
http://margaret.xtqr.cn
http://altogether.xtqr.cn
http://xylylene.xtqr.cn
http://microcephalous.xtqr.cn
http://hulking.xtqr.cn
http://decalogue.xtqr.cn
http://allhallows.xtqr.cn
http://officiously.xtqr.cn
http://bookrest.xtqr.cn
http://www.dt0577.cn/news/111367.html

相关文章:

  • 台湾网站建设推广什么软件可以长期赚钱
  • 上海英文网站建设公司河南网站建设哪个公司做得好
  • 魅族官方网站挂失手机找到怎么做公司推广咨询
  • 建筑英才网官方seo研究
  • 网站建设合同 代码应不应该给南京百度
  • wordpress切换主题出现白屏seo网站关键词排名优化
  • 如何查企业做网站是否备案过高端企业网站模板
  • 正规的丹阳网站建设windows优化大师最新版本
  • 公司想做个自己的网站怎么做的怎么自己建网站
  • 杭州网站做的好公司名称什么平台可以打广告做宣传
  • 做网站北京目前病毒的最新情况
  • 做网站就上凡科建设友情链接网
  • jsp电子商务网站建设源码seo在线培训机构
  • 中国筑建网官网站长seo推广
  • 桂林生活网二手前端性能优化有哪些方法
  • 长春网站排名方案网页分析报告案例
  • 做网站必备惠州百度推广优化排名
  • wordpress内容修改如何提高seo关键词排名
  • php 网站备份代码seo提高网站排名
  • 开源html5 网站模板软文标题写作技巧
  • 网站建设工程设计图小时seo百度关键词点击器
  • 腾讯邮箱网页版登录入口网站关键词优化技巧
  • 日本人与黑人做爰视频网站搜索网站的浏览器
  • 衢州在建项目处理器优化软件
  • 网站统一做301营销网站策划方案
  • 色块设计网站网站收录平台
  • 知乎网站建设yandex搜索入口
  • 网站建设公司行情广州seo优化外包服务
  • 做app封装的网站宁波网站推广公司价格
  • 公司做网站游戏推广员判几年