修复扫码功能重复触发问题
This commit is contained in:
parent
7c23a3f002
commit
ee0d5f202e
@ -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); // 给一点缓冲
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user