欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 维修 > uniapp、微信小程序车牌的录入的解决方案

uniapp、微信小程序车牌的录入的解决方案

2025/2/24 4:15:20 来源:https://blog.csdn.net/CHENC0518/article/details/141680986  浏览:    关键词:uniapp、微信小程序车牌的录入的解决方案

结合uv-ui进行编写,键盘使用uv-ui的组件,其他由我们自己编写。

<template><div class="addCarContent"><div class="boxContent"><div class="carCodeInput" @click="getIndex"><div:class="[index === 0 && showActive ? 'input_active' : '', 'input']">{{ CarCode[0] }}</div><div:class="[index === 1 && showActive ? 'input_active' : '', 'input']">{{ CarCode[1] }}</div><div class="point"></div><div:class="[index === 2 && showActive ? 'input_active' : '', 'input']">{{ CarCode[2] }}</div><div:class="[index === 3 && showActive ? 'input_active' : '', 'input']">{{ CarCode[3] }}</div><div:class="[index === 4 && showActive ? 'input_active' : '', 'input']">{{ CarCode[4] }}</div><div:class="[index === 5 && showActive ? 'input_active' : '', 'input']">{{ CarCode[5] }}</div><div:class="[index === 6 && showActive ? 'input_active' : '', 'input']">{{ CarCode[6] }}</div><div:class="[index === 7 && showActive ? 'input_active' : '', 'input']">{{ CarCode[7] }}</div></div></div><uv-keyboardref="keyboard"mode="car"@change="change":showTips="false"@confirm="confirm"@backspace="backspace":autoChange="true":overlay="true":safeAreaInsetBottom="true":confirmText="'完成'"@changeCarInputMode="changeCarInputMode"@close="closeKey"><template v-slot:abc><text v-if="isABC">省份</text><text v-else>ABC</text></template></uv-keyboard></div>
</template><script>
export default {data() {return {CarCode: ["", "", "", "", "", "", "", ""],index: "",isABC: false,showActive: false,checkboxValue: ["true"],};},onShow() {this.getIndex();},mounted() {},methods: {closeKey() {this.showActive = false;},changeCarInputMode(e) {this.isABC = e;},getIndex() {let index = this.CarCode.indexOf("");if (index !== -1) {this.index = index;} else {this.index = 7;}this.$refs.keyboard.open();this.showActive = true;},change(e) {console.log("change", e, this.index);if (this.index <= 7) {this.CarCode[this.index] = e;this.index++;if (this.index > 7) {this.$refs.keyboard.close();this.showActive = false;this.index--;}}console.log("changeEnd", this.CarCode);},confirm() {console.log("confirm");},backspace() {console.log("backspace", this.index);if (this.index === 1) {this.$refs.keyboard.changeCarMode();}if (this.index >= 0) {if (this.CarCode[this.index] === "") {this.index--;this.CarCode[this.index] = "";} else {this.CarCode[this.index] = "";}if (this.index < 0) {this.index = 0;}}this.$forceUpdate();console.log("backspaceEnd", this.CarCode, this.index);},},
};
</script>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词