获取焦点优化

This commit is contained in:
2024-05-13 17:17:05 +08:00
parent bf3721c786
commit 93d5342ca1

View File

@@ -8,7 +8,7 @@
<span class="filter_label">木箱</span> <span class="filter_label">木箱</span>
</view> </view>
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<search-box v-model="val1" :focused="focusedStatus" @handleChange="handleChange1" <search-box ref="scanChild" v-model="val1" @handleChange="handleChange1"
/> />
</view> </view>
</view> </view>
@@ -65,7 +65,6 @@
}, },
data() { data() {
return { return {
focusedStatus: true,
val1: '', val1: '',
billCode: '', billCode: '',
dataList: [], dataList: [],
@@ -76,6 +75,9 @@
this.billCode = option.billcode this.billCode = option.billcode
this._stivtDtlQuery() this._stivtDtlQuery()
}, },
mounted () {
this.$refs.scanChild.handleFocus()
},
methods: { methods: {
handleChange1 (e) { handleChange1 (e) {
this._stivtDtlQuery() this._stivtDtlQuery()
@@ -90,24 +92,12 @@
url: '/pages/WarehouseManage/ProdDeliveryDtl?boxno=' + code + '&billcode=' + this.billCode url: '/pages/WarehouseManage/ProdDeliveryDtl?boxno=' + code + '&billcode=' + this.billCode
}) })
}, },
// handleTest () {
// this.focusedStatus = false
// this.val1 = ''
// setTimeout(()=>{
// uni.showToast({
// title: 'toast',
// icon: 'none'
// })
// this.focusedStatus = true
// },3000)
// },
/** 初始化查询 */ /** 初始化查询 */
async _stivtDtlQuery () { async _stivtDtlQuery () {
let res = await stivtDtlQuery(this.val1, this.billCode) let res = await stivtDtlQuery(this.val1, this.billCode)
this.dataList = [...res.data] this.dataList = [...res.data]
}, },
async _stoutConfirm () { async _stoutConfirm () {
this.focusedStatus = false
this.disabled1 = true this.disabled1 = true
try { try {
let res = await stoutConfirm(this.val1) let res = await stoutConfirm(this.val1)
@@ -118,7 +108,7 @@
title: res.message, title: res.message,
icon: 'none' icon: 'none'
}) })
this.focusedStatus = true this.$refs.scanChild.handleFocus()
} catch (e) { } catch (e) {
this.disabled1 = false this.disabled1 = false
} }