首页  >  问答  >  正文

React 中 Sun 编辑器中的默认值

我想为 Sun 编辑器设置默认值。

我从数据库获取的默认值

我像这样设置了默认值,但它不起作用。

<SunEditor
     autoFocus={true}
     onChange={handleEditorChange}
     setOptions={toolbarOptions}
     defaultValue={guide.description}
/>

数据库中的数据 在此输入图像描述

只有这样才有效

<SunEditor
     autoFocus={true}
     onChange={handleEditorChange}
     setOptions={toolbarOptions}
     defaultValue={"<p>The editor's default value</p>"}
/>

P粉438918323P粉438918323377 天前508

全部回复(1)我来回复

  • P粉885035114

    P粉8850351142023-09-09 09:53:46

    尝试react-sun-editor的api函数

    <SunEditor
         autoFocus={true}
         onChange={handleEditorChange}
         setOptions={toolbarOptions}
         setContents={guide.description}
    />

    Suneditor-react 自述文件链接

    回复
    0
  • 取消回复