value 提供原始文本,label 说明扫码对象。组件只编码内容,链接创建、访问权限和有效期由调用方处理。
基本用法与下载
更新 value 后图案同步变化,空格和 Unicode 字符原样保留。actions 插槽提供 status 和 download,
可组合标准按钮;download({ format, fileName }) 支持 PNG / SVG,失败时拒绝 Promise。
扫码区域始终保留黑色模块、白色背景和完整留白,明暗主题下均保持一致。
图形尺寸
size 设置包含留白的正方形尺寸,默认 160 CSS 像素,窄容器内等比收缩。
长内容会增加图案密度,应相应增大尺寸并检查实际扫码效果。PNG 按显示尺寸和设备像素比导出,SVG 保留矢量。
纠错等级
errorCorrection 支持 L、M、Q、H,默认 M。更高等级通常需要更密集的图案;
纠错不替代完整留白,也不保证内容被遮盖后仍能识别。
空内容与生成失败
空字符串和内容无法编码时显示提示,文案跟随 Locale Provider。这两种状态不保留旧二维码, 重新传入有效内容即可恢复。组件不创建自动播报,页面可按任务组合反馈。
实例方法与可访问性
模板引用提供只读 status、download(options) 和 getDataUrl(format);图片生成方法须在挂载后调用,
没有可用图案时拒绝 Promise。label 是图片的可访问名称,另提供可读文本或 Clipboard,
让无法扫码的用户完成同一任务。
API
QuireQRCode Props
Slots 内容位置
actionsOptional actions outside the scan area, such as public Button downloads.
{ /** Current content availability; disable export actions unless ready. */ status: "empty" | "ready" | "error"; /** Exports the mounted symbol using Ark's SVG and raster conversion. */ getDataUrl: { (format?: QuireKitQRCodeFormat | undefined): Promise<string>; }; /** Starts a browser download of the mounted symbol. */ download: { (options?: QuireKitQRCodeDownloadOptions | undefined): Promise<void>; }; }
Events 组件事件
无自定义事件。
公开实例成员
statusQuireKitQRCodeStatusgetDataUrl(format?: QuireKitQRCodeFormat) => Promise<string>download(options?: QuireKitQRCodeDownloadOptions) => Promise<void>