This commit is contained in:
aihe 2024-08-05 23:25:05 +08:00
parent cb427b0c3b
commit a00ebbf01e
2 changed files with 34 additions and 5 deletions

View File

@ -2,7 +2,7 @@
<u-row>
<u-input :placeholder="placeholder" :fontSize="fontSize" :modelValue="value"
:custom-style="`border-radius: 10rpx;padding: 11rpx 20rpx;${customStyle};`"
@change="handleInputChange"
@change="handleInputChange" @blur="handleInputBlur" @focus="handleInputFocus"
>
<template v-if="iconPos == 'left'" v-slot:prefix>
<u-icon @click="handleScan" name="scan" :size="fontSize*1.5"></u-icon>
@ -17,13 +17,26 @@
<u-button custom-style="height: 70rpx;" :plain="true">确认</u-button>
</view>
</u-row>
<tpx-physics-scan @onChange="handleScanChange"></tpx-physics-scan>
<tpx-physics-scan v-if="showPhysics" @onChange="handleScanChange"></tpx-physics-scan>
</template>
<script>
import { scanCode } from "@/common/untool"
export default {
computed: {
showPhysics() {
let bl = false
if(this.phyTrigger == 'loaded') {
debugger
bl = true
}
if(this.phyTrigger == 'focus' && this.isInputFocused) {
debugger
bl = true
}
return bl
},
},
props: {
value: {
@ -61,8 +74,16 @@
return false
}
},
phyTrigger:{ // 红外监听方式
default () {
return 'loaded' // loaded:组件加载 focus:输入框获取焦点
}
},
},
data() {
return {
isInputFocused: false
}
},
created() {
@ -91,6 +112,14 @@
},
handleConfirm(){
this.$emit('confirmClick')
},
handleInputBlur(){
this.isInputFocused = false
this.$emit('blur')
},
handleInputFocus(){
this.isInputFocused = true
this.$emit('focus')
}
}
}

View File

@ -6,7 +6,7 @@
<u-row justify="between">
<view style="flex:1;">
<tpx-scan-input v-model:value="submitParam.billCode" placeholder="运单号, 请输入或扫码"
@scanChange="handleScanValChange" :showConfirm="true" @confirmClick="handleScanValChange" iconPos="left"></tpx-scan-input>
phyTrigger="focus" @scanChange="handleScanValChange" :showConfirm="true" @confirmClick="handleScanValChange" iconPos="left"></tpx-scan-input>
</view>
</u-row>
<u-row custom-style="margin-top:20rpx;">
@ -17,7 +17,7 @@
<u-row custom-style="margin-top:20rpx;">
<view style="flex: 1;">
<tpx-scan-input v-model:value="submitParam.bagNo" placeholder="合包号, 请输入或扫码"
iconPos="left"></tpx-scan-input>
phyTrigger="focus" iconPos="left"></tpx-scan-input>
</view>
<!-- <view class="pl-10">
<u-button @click="handleCreatePaNo()"