我想为 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>"}
/> Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
尝试react-sun-editor的api函数
<SunEditor autoFocus={true} onChange={handleEditorChange} setOptions={toolbarOptions} setContents={guide.description} />Suneditor-react 自述文件链接