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

wordpress wp-pic主题湖南网站seo

wordpress wp-pic主题,湖南网站seo,公司网站如何做全屏滚轮,crm平台组件功能分析 1.按键删除,清空当前input,并跳转prevInput & 获取焦点,按键delete,清空当前input,并跳转nextInput & 获取焦点。按键Home/End键,焦点跳转first/最后一个input输入框。ArrowLeft/ArrowRight键点击…

组件功能分析
1.按键删除,清空当前input,并跳转prevInput & 获取焦点,按键delete,清空当前input,并跳转nextInput & 获取焦点。按键Home/End键,焦点跳转first/最后一个input输入框。ArrowLeft/ArrowRight键点击后跳转上一个/下一个输入框获取焦点。
2.判断按键为数字,则取第一个数字,然后跳转下一个input输入框获取焦点,如果为最后一个,则失去焦点,交互结束。
3.粘贴功能。通过el.clipboardData获取粘贴内容,判断是否为4/6位粘贴内容。是则赋值给页面Input,双向绑定一个数组即可。否则置为空。

代码展示

<template><div class="g-remove-check-code"><p class="g-remove-check-code_title">发送验证码</p><div class="g-remove-check-code"><p class="g-remove-check-code_title">请输入短信验证码以验证您的身份</p><divclass="g-remove-check-code_content"@keyup="fnCheckCodeKeyup"@keydown="fnCheckCodeKeydown"@paste="fnCheckCodeKeyPaste"@input="fnCheckCodeInputEvent"><input :class="{'g-code-input_color': aCheckCodeInputComputed[0] !== ''}" max="9" min="0" maxlength="1" data-index="0" v-model.trim.number="aCheckCodeInputComputed[0]" type="text" ref="firstInputRef" /><input :class="{'g-code-input_color': aCheckCodeInputComputed[1] !== ''}" max="9" min="0" maxlength="1" data-index="1" v-model.trim.number="aCheckCodeInputComputed[1]" type="text" /><input :class="{'g-code-input_color': aCheckCodeInputComputed[2] !== ''}" max="9" min="0" maxlength="1" data-index="2" v-model.trim.number="aCheckCodeInputComputed[2]" type="text" /><input :class="{'g-code-input_color': aCheckCodeInputComputed[3] !== ''}" max="9" min="0" maxlength="1" data-index="3" v-model.trim.number="aCheckCodeInputComputed[3]" type="text" /></div></div><div class="btn-box"><button:disabled="!turnOff"content-text="下一步"@clickEvent="enter"/></div></div>
</div>
</template><script lang="ts" setup>
import { defineComponent, ref, onMounted, onUnmounted, reactive, computed, getCurrentInstance, inject  } from "vue";let aCheckCodeInput = ref(["", "", "", ""]) 	// 存储输入验证码内容let aCheckCodePasteResult = ref([]) 	const turnOff = computed(() => {return aCheckCodeInputComputed.value.filter((v) => !!v)?.length >= 4;});onUnmounted(() => {clearInterval(timer.value);})const enter = async () => {console.log("your code",aCheckCodeInputComputed.value.join("").toUpperCase())}const aCheckCodeInputComputed = computed(() => {if(aCheckCodePasteResult.value.length === 4) {return aCheckCodePasteResult.value;} else if (aCheckCodeInput.value && Array.isArray(aCheckCodeInput.value) && aCheckCodeInput.value.length === 4) {return aCheckCodeInput.value;} else if (/^\d{4}$/.test(aCheckCodeInput.value.toString())) {return aCheckCodeInput.value.toString().split("");} else {return new Array(4);}})// 输入验证码,更新验证码数据const fnCheckCodeKeyup = (e: any) => {let index = e?.target?.dataset.index * 1;let el = e.target;// 解决输入e的问题el.value = el.value.replace(/Digit|Numpad/i, "").slice(0, 1);if (/Digit|Numpad/i.test(e.code)) {// 必须在这里赋值,否则输入框会是空值aCheckCodeInput.value.splice(index, 1, e.code.replace(/Digit|Numpad/i, ""));el.nextElementSibling && el.nextElementSibling.focus();if (index === 3) {if (aCheckCodeInput.value.join("").length === 4)  (document.activeElement as any).blur();}}}// 输入验证码,检测位置变化const fnCheckCodeKeydown = (e: any) =>{let index = e?.target?.dataset?.index * 1;let el = e.target;if (e?.key === "Backspace") {if (aCheckCodeInput.value[index].length > 0) {aCheckCodeInput.value.splice(index, 1, "");} else {if (el.previousElementSibling) {el.previousElementSibling.focus();aCheckCodeInput.value[index - 1] = "";}}} else if(e?.key === "Delete") {if (aCheckCodeInput.value[index].length > 0) {aCheckCodeInput.value.splice(index, 1, "");} else {if(el.nextElementSibling) {el.nextElementSibling.focus();aCheckCodeInput.value[++index] = "";}}} else if (e?.key === "Home") {el?.parentElement?.children[0] && el.parentElement.children[0].focus();} else if (e?.key === "End") {el?.parentElement?.children[aCheckCodeInput.value.length - 1] &&el?.parentElement?.children[aCheckCodeInput.value.length - 1].focus();} else if (e?.key === "ArrowLeft") {if (el?.previousElementSibling) el?.previousElementSibling.focus();} else if (e?.key === "ArrowRight") {if (el?.nextElementSibling) el?.nextElementSibling.focus();} else if(e.key === 'Enter') {this.doActive()}}// 输入验证码,解决一个输入框输入多个字符的问题const fnCheckCodeInputEvent = (e: any) => {let index = e?.target?.dataset?.index * 1;let el = e?.target;el.value = el?.value.replace(/Digit|Numpad/i, "").slice(0, 1);aCheckCodeInput.value[index] = el.value;}// 验证码粘贴const fnCheckCodeKeyPaste = (e: any) =>{e?.clipboardData?.items[0].getAsString((str: string) => {if (str.toString().length === 4) {aCheckCodePasteResult.value = str.split("") as any;(document.activeElement as any).blur();aCheckCodeInput.value = aCheckCodeInputComputed.value;aCheckCodePasteResult.value = [];} else {// 如果粘贴内容不合规,清除所有内容aCheckCodeInput.value = ["", "", "", ""];}});}
</script>
<style scoped lang="scss">
.g-remove-check-code {width: 100%;padding: 4px 0 8px 0;
}.g-remove-check-code .g-remove-check-code_title {font-size: 14px;color: #666;
}.g-remove-check-code .g-remove-check-code_content {display: flex;justify-content: space-between;align-items: center;width: 400px;padding: 28px 0 28px 0;margin: 0 auto;
}.g-remove-check-code .g-remove-check-code_content input {width: 50px;height: 50px;font-size: 36px;text-align: center;border: none;outline: none;border: solid 1px rgba(187, 187, 187, 100);border-radius: 4px;-moz-appearance: textfield;
}.g-remove-check-code .g-remove-check-code_content input.g-code-input_color {border-color: #5290FF;
}.g-remove-check-code .g-remove-check-code_content input::-webkit-outer-spin-button,
.g-remove-check-code .g-remove-check-code_content input::-webkit-inner-spin-button {appearance: none;margin: 0;
}.g-remove-check-code .g-remove-check-code_tip {font-size: 14px;color: #999;text-align: center;
}
</style>

效果展示
在这里插入图片描述

http://www.hkea.cn/news/46785/

相关文章:

  • 开封网站建设哪家好指数计算器
  • 网站开发 架构石家庄seo关键词排名
  • 可以免费做商业网站的cms百度seo霸屏软件
  • 哪家网站建设专业快速建站教程
  • 坪山网站建设行业现状优化seo方案
  • 做网站需要架构师吗网站平台有哪些
  • 网站建设丿选择金手指15凡科建站官网
  • 可以做外国网站文章武汉企业seo推广
  • 天津网站建设公司最好太原做网站哪家好
  • 网站代下单怎么做百度指数数据分析平台入口
  • 淘宝做动效代码的网站seo的优化方向
  • 番禺建网站公司网站搜索工具
  • 安徽万振建设集团网站长春网站推广公司
  • 网站怎么制作 推广seo超级外链工具免费
  • 中小学网站建设探讨东莞seo整站优化火速
  • php是网站开发的语言吗企业网站的作用
  • 网站站外优化怎么做企业推广app
  • 拉趣网站是谁做的威海网站制作
  • 做宣传海报的网站百度导航2023年最新版
  • 湖南做网站 磐石网络windows优化大师官方免费
  • 制作网站的最新软件如何优化关键词的方法
  • 东莞工作招聘网最新招聘搜索 引擎优化
  • 宁波俄语网站建设免费发广告的平台有哪些
  • 郑州外贸网站建设及维护营销软件商城
  • 泉州百度关键词排名广州网站营销优化qq
  • 怎么做wep网站营销推广活动方案
  • 展示型网站php官方app下载安装
  • 嘉祥网站建设广东省自然资源厅
  • 忘记网站后台密码网站排名软件推荐
  • 怎么查公司网站有没有被收录火爆产品的推广文案