如何 2秒触发一次 @scancode="onScancode"事件呢 ?
二维码扫码 <camera class="scan-area" @scancode="onScancode" @error="onError" mode="scanCode" device-position="back" flash="auto" frame-size="large"></camera> onScancode(e) { wx.vibrateShort() //开启震动模式 let innerAudioContext = uni.createInnerAudioContext() innerAudioContext.src = 'http://172.26.3.48:8888/resource/public/upload/2023-10-23/cwflgq1yhqlosg2dol.mp3' innerAudioContext.play() //声音播放模式 if (e.detail.type != 'barcode') { wx.showToast({ title: '请扫描条形码', icon: 'error', duration: 1000 // 显示时间,根据需要调整 }) } else { this.getData(e.detail.result) } },