小程序:质检报工调整,将输入和扫码事件拆分为
This commit is contained in:
parent
fbab232b17
commit
6f60eed92d
@ -12,6 +12,7 @@ const userId = userStore.userInfo.userId
|
||||
const isFinish = ref(false)
|
||||
// 是否继续扫码
|
||||
const isScan = ref(false)
|
||||
const isFromScan = ref(false)
|
||||
// 是否触发下拉刷新
|
||||
const isTriggered = ref(false)
|
||||
// 定义 porps
|
||||
@ -132,6 +133,10 @@ const handleSearch = async (e) => {
|
||||
saveSearchValue(queryParams.subOrDetailName)
|
||||
await getListData();
|
||||
};
|
||||
const onInputSearch = (e) => {
|
||||
if (isFromScan.value) return;
|
||||
handleSearch({ inputValue: e.detail?.value ?? searchVal.value });
|
||||
};
|
||||
const viewClick = async (item) => {
|
||||
const params = {
|
||||
id: item.id
|
||||
@ -145,8 +150,10 @@ const viewClick = async (item) => {
|
||||
const handleScan = async() => {
|
||||
uni.scanCode({
|
||||
success: async(res) => {
|
||||
isFromScan.value = true
|
||||
searchVal.value = res.result
|
||||
await handleSearch({ inputValue: res.result })
|
||||
await handleSearch({ inputValue: res.result })
|
||||
isFromScan.value = false
|
||||
if (isScan.value){
|
||||
handleScan()
|
||||
}
|
||||
@ -230,7 +237,7 @@ const onRefresherrefresh = async () => {
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
"
|
||||
@input="handleSearch({ inputValue: searchVal })"
|
||||
@input="onInputSearch"
|
||||
clearable
|
||||
/>
|
||||
<view
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, toRefs,nextTick,onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
// import { useRoute } from 'vue-router';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
||||
const title = ref('图片预览');
|
||||
const src = ref([]);
|
||||
const route = useRoute();
|
||||
// const route = useRoute();
|
||||
const picture = ref('');
|
||||
const previewImage = ref(null);
|
||||
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, toRefs,nextTick,onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
// import { useRoute } from 'vue-router';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
||||
const title = ref('图片预览');
|
||||
const src = ref([]);
|
||||
const route = useRoute();
|
||||
// const route = useRoute();
|
||||
const picture = ref('');
|
||||
const previewImage = ref(null);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user