From 9ab6b38c098f857f2ce0772693142c930e4f9b6d Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期六, 30 三月 2024 10:44:03 +0800 Subject: [PATCH] # --- components/z-input/z-input.vue | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) diff --git a/components/z-input/z-input.vue b/components/z-input/z-input.vue index de6b18f..287ed1b 100644 --- a/components/z-input/z-input.vue +++ b/components/z-input/z-input.vue @@ -6,9 +6,9 @@ <uni-icons class="p-icon" type="scan" size="16" - color="#b9b9b9" - v-show="data.length" - @click="clear"> + color="#a6a6a6" + @click="scanCode" + > </uni-icons> <input class="p-input" type="text" @@ -85,6 +85,7 @@ return } if (val.length != this.lenCheck) { + console.log(val); setTimeout(()=>{ this.data = '' this.$emit('input','') @@ -115,7 +116,17 @@ this.$emit('clickBtn'); }, inputVal() { - this.$emit('inputVal',[this.data,this.name]); + this.$emit('inputVal',{title:this.name,value:this.data}); + }, + scanCode() { + let _this = this + uni.scanCode({ + onlyFromCamera: true, + success(res) { + _this.data = res.result + _this.$emit('inputVal',{title:_this.name,value:_this.data}) + } + }) } } } @@ -127,7 +138,6 @@ align-items: center; min-height: 50px; background-color: #fff; - margin-right: 8px; } .put { display: flex; @@ -148,6 +158,7 @@ align-items: center; justify-content: center; border-radius: 5px; + margin-right: 32rpx; color: #606266; } .p-input { @@ -159,7 +170,7 @@ margin-right: 4px; } .inner3 { - width: 100px; + width: 90px; display: flex; align-items: center; justify-content: center; -- Gitblit v1.9.1