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/genui/a2ui/functions/defineCatalog.md.
Lynx
  • 简体中文
  • 函数: defineCatalog()

    defineCatalog(inputs: readonly CatalogInput[]): Catalog

    用组件、[component, manifest] 对和/或函数条目构建 catalog。同一类别中重复的名称会被拒绝。函数条目会立即把实现注册到 functionRegistry,因此 defineCatalog 之后的任何 executeFunctionCall 都能路由到它们。

    参数

    参数类型
    inputsreadonly CatalogInput[]

    返回

    Catalog

    示例

    import { Text, Button } from '@lynx-js/genui/a2ui';
    import { defineCatalog, defineFunction } from '@lynx-js/genui/a2ui';
    import { required } from '@lynx-js/genui/a2ui/functions';
    import textManifest from '@lynx-js/genui/a2ui/catalog/Text/catalog.json'
      with { type: 'json' };
    
    const catalog = defineCatalog([
      [Text, textManifest],
      Button,
      defineFunction(required),
    ]);
    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。