使用Scan Kit(统一扫码服务),通过文本生成生成码

使用Scan Kit(统一扫码服务),通过文本生成生成码

HarmonyOS
2024-08-07 09:17:11
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
噜啦噜啦嘞噜啦嘞
// 通过文本生成生成码 Promise方式
      Button('生成码').genButton()
        .onClick(() => {
          this.pixelMap = undefined;
          let content = this.mContext;
          let options: generateBarcode.CreateOptions = {
            scanType: this.mScanType,
            width: Number(this.mWidth),
            height: Number(this.mHeight),
            margin: Number(this.mMargin),
            level: this.mLevel,
            backgroundColor: this.mBackgroundColor,
            pixelMapColor: this.mPixelMapColor,
          }
          try {
            generateBarcode.createBarcode(content, options).then((result: image.PixelMap) => {
              this.pixelMap = result;
            }).catch((error: BusinessError) => {
              hilog.error(0x0001, TAG,
                `Failed to get pixelMap by promise with options. Code: ${error.code}, message: ${error.message}`);
            })
          } catch (error) {
            showError(error);
            hilog.error(0x0001, TAG, `Failed to createBarCode. Code: ${error.code}, message: ${error.message}`);
          }
        })
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
分享
微博
QQ
微信
回复
2024-08-07 11:24:17
相关问题
HarmonyOS APP可以生成二维安装
1568浏览 • 1回复 待解决
如何生成时的镂空遮罩?
717浏览 • 1回复 待解决
Scan Kit无法识别多个
2421浏览 • 1回复 待解决
HarmonyOS 服务权限问题
930浏览 • 1回复 待解决
相册识别多失败
2668浏览 • 1回复 待解决
HarmonyOS 二维生成失败
771浏览 • 1回复 待解决
HarmonyOS 二维生成的demo
1148浏览 • 2回复 待解决
HarmonyOS 系统一扫问题
618浏览 • 1回复 待解决
AI生成能力中文字符乱码
10439浏览 • 1回复 待解决