For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/api/genui/openui/functions/useSetDefaultValue.md.
Lynx
  • 简体中文
  • genui / openui / useSetDefaultValue

    useSetDefaultValue()

    function useSetDefaultValue(shouldTriggerSaveCallback: object): void

    Persists a component's default/initial value into form state once streaming finishes — but only if the user hasn't already set a value.

    Call this inside any form component that has a defaultValue or defaultChecked prop. It is a no-op during streaming so that LLM prop changes don't fight with partial state.

    参数

    范围类型描述
    shouldTriggerSaveCallbackobjectDefaults to false (only local state, no message persistence).
    shouldTriggerSaveCallback.componentType?string-
    shouldTriggerSaveCallback.defaultValueunknown-
    shouldTriggerSaveCallback.existingValueunknown-
    shouldTriggerSaveCallback.formName?string-
    shouldTriggerSaveCallback.namestring-
    shouldTriggerSaveCallback.shouldTriggerSaveCallback?boolean-

    返回

    void

    定义于

    @lynx-js/genui/openui/src/core/context.tsx:182

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。