跳转至

Widget: QR Code Reader(小组件(Widget):二维码读取器)

The QR Code Reader widget allows you to prompt users to scan a QR code using their system camera. The widget allows you to flexibly configure a button to prompt users to scan a code:

qr code button

Upon selecting the button, users are prompted to grant camera access, then they can scan one or more QR codes using a fullscreen camera:

qr code scanner open

The scanned QR code data is made available as a Workshop variable, which you can use as desired in your application. For example, you can show the scanned data to the user directly using a Markdown widget, use it to look up objects by configuring an Object Set variable, or use the scanned data to prefill an Action form input to capture the data into Foundry.

Configuration options

Below are the core configuration options for the QR Code Reader:

  • Single or multiple code: Configures whether the widget scans the first code it sees, or allows users to scan multiple codes in a row. If multiple code mode is selected, then the scanned data will be output as a string array variable. If single code is selected, then the scanned data is a string variable.
  • Should prompt user before scanning: When enabled, the user will be prompted to select a Scan code button to confirm that a code should be scanned. When disabled, any detected QR code will be scanned immediately.
  • Button configuration: Configuration options for the button used to open the full-screen QR Code Reader. This is identical to the configuration for an individual button in the Button Group Widget.

中文翻译

小组件(Widget):二维码读取器

二维码读取器小组件允许您提示用户使用系统摄像头扫描二维码。该小组件支持灵活配置按钮,以提示用户扫码:

二维码按钮

点击该按钮后,系统会提示用户授予摄像头访问权限,随后用户即可使用全屏摄像头扫描一个或多个二维码:

打开二维码扫描器

扫描获取的二维码数据将作为 Workshop 变量(variable) 提供,您可以根据需要在应用程序中使用这些数据。例如,您可以使用 Markdown 小组件直接向用户展示扫描数据,通过配置对象集(Object Set)变量来查找对象,或者使用扫描数据预填充操作(Action)表单输入框,从而将数据采集到 Foundry 中。

配置选项

以下是二维码读取器的核心配置选项:

  • 单码或多码: 配置该小组件是仅扫描识别到的第一个二维码,还是允许用户连续扫描多个二维码。如果选择多码模式,扫描数据将输出为字符串数组变量。如果选择单码模式,扫描数据则为字符串变量。
  • 扫描前提示用户: 启用后,系统会提示用户点击扫码按钮以确认开始扫描。禁用后,系统将立即扫描检测到的任何二维码。
  • 按钮配置: 用于打开全屏二维码读取器的按钮配置选项。此配置与按钮组小组件(Button Group Widget)中单个按钮的配置完全相同。