gruhn / vue-qrcode-reader

A set of Vue.js components for detecting and decoding QR codes.
https://gruhn.github.io/vue-qrcode-reader
MIT License
2.03k stars 330 forks source link

版本3.1.9是否支持formats?如果不支持我应该如何实现? #413

Closed carpONE closed 3 months ago

Sec-ant commented 5 months ago

见 #372,需要有需求的开发者贡献代码,并参考 https://github.com/gruhn/vue-qrcode-reader/issues/406#issuecomment-1882875138 提交 PR。

carpONE commented 5 months ago

在本地调试中,我加了data_matrix参数,扫码时还是不支持data_matrix类型? image

Sec-ant commented 5 months ago

如果在这个 demo 页面data_matrix 是能够正常工作的,那么问题就不是出在 BarcodeDetector 中,而是可能出在你实现方式上。建议先用最小的可复现 demo 来定位问题出现的位置和原因,并参考 5.x 版本的代码调整 3.x 的结构。

carpONE commented 5 months ago

我不太确定是否BarcodeDetector 的版本问题,这个demo版本是可以的,但这个demo是5.x版本,由于5.x版本中的BarcodeDetector与3.x版本的不一样,3.x版本的BarcodeDetector 版本是1.0.3在npm官网上搜索不到

Sec-ant commented 5 months ago

我不太确定是否BarcodeDetector 的版本问题,这个demo版本是可以的,但这个demo是5.x版本,由于5.x版本中的BarcodeDetector与3.x版本的不一样,3.x版本的BarcodeDetector 版本是1.0.3在npm官网上搜索不到

你需要更新 BarcodeDetector 版本。实际上 BarcodeDetector 1.x 是另外一个包,现在已经不维护了,它也不支持其他 formats。目前继续维护的版本是 2.x,所以这个依赖需要升级到 2.x。

carpONE commented 5 months ago

是的,升级后是可以识别了,我是否 可以推送到3.x分支上?

Sec-ant commented 5 months ago

是的,升级后是可以识别了,我是否 可以推送到3.x分支上?

ok,不过我并不是本仓库的维护者,提交 PR 时建议用英文写明做了哪些修改,然后让仓库拥有者 @gruhn 审查修改并合并。

carpONE commented 5 months ago

好的,谢谢

carpONE commented 5 months ago

提交失败,是不是网络问题?显示如下: image

错误内容如下: WARN  GET https://registry.npmjs.org/--no-install error (ETIMEDOUT). Will retry in 10 seconds. 2 retries left.  WARN  GET https://registry.npmjs.org/--no-install error (ETIMEDOUT). Will retry in 1 minute. 1 retries left. D:.pnpm-store\v3\tmp\dlx-15668:  ERR_PNPM_META_FETCH_FAIL  GET https://registry.npm.taobao.org/--no-install: request to https://registry.npmjs.org/--no-install failed, reason: connect ETIMEDOUT 104.16.25.34:443 This error happened while installing a direct dependency of D:.pnpm-store\v3\tmp\dlx-15668

Sec-ant commented 5 months ago

像是命令行参数有些问题,搜了一下可能和这个问题有关,应该要先正确安装一下 husky:https://github.com/pnpm/pnpm/issues/4790

carpONE commented 5 months ago

@Sec-ant 现在出现这个问题,我应该怎么处理,能否帮我提交? remote: Permission to gruhn/vue-qrcode-reader.git denied to carpONE. unable to access 'https://github.com/gruhn/vue-qrcode-reader.git/': The requested URL returned error: 403

image

支持formats实现修改如下:

升级barcode-detector:pnpm i barcode-detector@2.2.2

QrcodeCapture.vue文件: image

QrcodeDropZone.vue文件: image

QrcodeStream.vue文件: image image

scanner.js文件: image image image

Sec-ant commented 5 months ago

你不能直接在本仓库创建分支,简单的 PR 提交步骤是:

  1. fork 一份本仓库到你的账户下;
  2. 将你 fork 的仓库克隆到本地;
  3. 本地切换到 "3.x" 分支;
  4. 基于 "3.x" 分支新建一个新的分支,名字可以为 "support-formats",反映你做的修改内容;
  5. 将你做的修改提交(commit)到这个新的分支;
  6. 将这个新的分支 push 到你 fork 的仓库中;
  7. 在 GitHub 上发起 Pull Request,source 是你仓库下的 "support-formats" 分支,target 是这个仓库下的 "3.x" 分支。

你先尝试一下这个步骤,如果你实在遇到困难,再考虑让我帮你提交。

github-actions[bot] commented 3 months ago

This issue has been marked as stale. If there is no further activity it will be closed.