From b3eccf66e62a7b6c5668ad128f3e764f79ec4bc9 Mon Sep 17 00:00:00 2001 From: whycq <123456> Date: 星期一, 25 四月 2022 11:42:56 +0800 Subject: [PATCH] # --- pages/basics/offline.vue | 29 ++++++++++++++++++++++++----- 1 files changed, 24 insertions(+), 5 deletions(-) diff --git a/pages/basics/offline.vue b/pages/basics/offline.vue index ac70a7a..a2bd6d2 100644 --- a/pages/basics/offline.vue +++ b/pages/basics/offline.vue @@ -8,7 +8,8 @@ </view> <view class="square-content"> <view class="content-input"> - <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8"> + <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" + maxlength="8" :focus="barcodeFocus" @focus="focuss"> <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons> </view> </view> @@ -34,7 +35,8 @@ </view> <view class="square-content"> <view class="content-input"> - <input v-model="matNo" type="text" placeholder="鎵爜 / 杈撳叆" @input="findMat()" :focus="focus"> + <input v-model="matNo" type="text" placeholder="鎵爜 / 杈撳叆" + @input="findMat()" :focus="focus" @focus="focuss" > <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMat()"></uni-icons> </view> </view> @@ -132,7 +134,9 @@ data() { return { barcode: '', - matList:[], + barcodeFocus:true, + focus:false, + matList:[{barcode:'92992929292'}], matNo:'', mat:null, type: 'center', @@ -146,7 +150,8 @@ enableQty:'', msgType: 'success', messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�', - focus:true + + } }, mounted(){ @@ -156,6 +161,9 @@ this.basePORT = UPORT }, methods: { + focuss() { + uni.hideKeyboard() + }, messageToggle(type) { this.msgType = type this.messageText = `杩欐槸涓�鏉�${type}娑堟伅鎻愮ず` @@ -170,10 +178,18 @@ removeBarcode() { this.barcode = '' uni.vibrateShort(); + this.barcodeFocus = false; + this.$nextTick(function() { + this.barcodeFocus = true; + }); }, removeMat() { this.matNo = '' uni.vibrateShort(); + this.focus = false; + this.$nextTick(function() { + this.focus = true; + }); }, eject(type) { this.type = type @@ -281,7 +297,10 @@ that.addMatList(that.mat) that.initAnfme() that.matNo = '', - console.log(that.focus) + that.focus = false; + that.$nextTick(function() { + that.focus = true; + }); } else { that.messageToggle('warn') that.messageText = '璇烽噸鏂版壂鐮� \ 杈撳叆' -- Gitblit v1.9.1