Home > @lynx-js/qrcode-rsbuild-plugin > PluginQRCodeOptions > schema

PluginQRCodeOptions.schema property

Customize the generated schema.

Signature:

schema?: CustomizedSchemaFn | undefined;

Example 1

import { pluginQRCode } from '@lynx-js/plugin-qrcode'
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  plugins: [
    pluginQRCode({
      schema(url) {
        return `lynx://${url}?dev=1`
      },
    }),
  ],
})

Example 2

  • Use multiple schemas:

You may press a in the terminal to switch between schemas.

import { pluginQRCode } from '@lynx-js/plugin-qrcode'
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  plugins: [
    pluginQRCode({
      schema(url) {
        return {
          http: url,
          foo: `foo://lynx?url=${encodeURIComponent(url)}&dev=1`,
          bar: `bar://lynx?url=${encodeURIComponent(url)}`,
        }
      },
    }),
  ],
})
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.