木箱不允许输入

This commit is contained in:
2023-08-16 18:37:56 +08:00
parent 9b9d5eb172
commit 8b5d490595
5 changed files with 246 additions and 40 deletions

View File

@@ -8,11 +8,9 @@
<span class="filter_label">木箱</span>
</view>
<view class="filter_input_wraper">
<search-box
v-model="val1"
:focused="true"
@handleChange="handleChange"
/>
<search-box-mx :focused="focused" @inputDel="inputDel" @inputScan="inputScan" @toPhone="toPhone">
<input type="text" v-model="val1" class="filter_input search_input" :focus="focused" @input="onKeyInput($event)" @blur="onBlur" @focus="focused = true">
</search-box-mx>
</view>
</view>
<view class="filter_item">
@@ -71,11 +69,13 @@
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import SearchBoxMx from '@/components/SearchBoxMx.vue'
import {boxQuery, stConfirm, stPrint} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
SearchBox,
SearchBoxMx
},
data() {
return {
@@ -84,17 +84,20 @@
isV: '0',
dataList: [],
disabled: false,
disabled1: false
disabled1: false,
focused: true
};
},
mounted () {
setTimeout(() => {
uni.hideKeyboard()
}, 500)
},
methods: {
/** 虚拟库 */
isVirtual () {
this.isV = this.isV === '0' ? '1' : '0'
},
handleChange (e) {
this._boxQuery(e)
},
/** 初始化查询 */
async _boxQuery (e) {
let res = await boxQuery(e, '4')
@@ -141,6 +144,32 @@
} catch (e) {
this.disabled1 = false
}
},
onKeyInput ($event) {
if ($event.target.value.length < 5) {
this.$nextTick(function(){
this.val1 = ''
uni.hideKeyboard()
})
return
}
this._boxQuery(this.val1)
},
onBlur () {
this.focused = false
},
inputDel () {
this.val1 = ''
},
inputScan () {
this.focused = true
setTimeout(() => {
uni.hideKeyboard()
}, 300)
},
toPhone (e) {
this.val1 = e
this._boxQuery(this.val1)
}
}
}