首頁  >  問答  >  主體

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 天前507

全部回覆(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
  • 取消回覆