For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/rspeedy/qrcode-rsbuild-plugin.pluginqrcodeoptions.schema.md.
Rspeedy logo
Rspeedy
  • 简体中文
  • 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/qrcode-rsbuild-plugin'
    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/qrcode-rsbuild-plugin'
    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)}`,
            }
          },
        }),
      ],
    })
    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。