修复扫码功能重复触发问题

This commit is contained in:
郑庆 2025-11-17 21:35:44 +08:00
parent 7c23a3f002
commit ee0d5f202e

View File

@ -76,12 +76,10 @@ const getListData = async () => {
//
try {
const data = await getListAPIWX(queryParams)
isLoading.value = false
if (data.data!=null){
uni.showToast({ title: data.data, icon: 'none' })
isScan.value=true;
//
setTimeout(() => {
handleScan()
}, delay.value * 1000);
@ -159,18 +157,22 @@ const viewClick = async (item) => {
}
};
const handleScan = async() => {
if (isScan.value) return
isScan.value = true
uni.scanCode({
success: async(res) => {
isFromScan.value = true
searchVal.value = res.result
await handleSearch({ inputValue: res.result })
isFromScan.value = false
if (isScan.value){
handleScan()
}
},
fail: () => {
uni.showToast({ title: '扫码失败或用户取消扫码', icon: 'none' })
},
complete: () => {
setTimeout(() => {
isScan.value = false;
}, 200); //
}
})
}