HarmonyOS 自定义界面扫码,识别成功一次后无法继续识别

XComponent({
  id: 'componentId',
  type: 'surface',
  controller: this.mXComponentController
})
  .onLoad(async () => {
    let viewControl: customScan.ViewControl = {
      width: this.cameraWidth,
      height: this.cameraHeight,
      surfaceId: this.mXComponentController.getXComponentSurfaceId()
    };
    customScan.start(viewControl)
      .then(async (result: Array<scanBarcode.ScanResult>) => {
        if (result.length > 0) {
          let barcode = result[0].originalValue
          ms_getLink(ENTER_VM_KEY)?.add(barcode)
        }
        // 处理扫码结果
        this.showScanResult(result);
      });
  })
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.

使用以上代码监听扫描识别条码成功的回调,但是它仅会执行一次,识别成功会就再也不会进入该回调了,请问有什么办法可以连续识别条码?

HarmonyOS
2025-01-10 07:53:25
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zbw_apple
分享
微博
QQ
微信
回复
2025-01-10 11:09:40
相关问题
自定义界面预览画面出现拉伸
2319浏览 • 1回复 待解决
相册识别失败
2439浏览 • 1回复 待解决
HarmonyOS 自定义咨询
507浏览 • 1回复 待解决
HarmonyOS 如何自定义页面
506浏览 • 1回复 待解决
HarmonyOS 自定义功能
566浏览 • 1回复 待解决
IDE无法识别自定义方法中做的检测
2089浏览 • 1回复 待解决
HarmonyOS 自定义的恢复态API
470浏览 • 1回复 待解决
Scan Kit无法识别多个
2218浏览 • 1回复 待解决