1、安裝
npm i summernote
2、創建頁面顯示區域
<div id="content"></div>
3、加載的時候進行初始化
js中引入
import 'summernote/dist/summernote' import 'summernote/dist/summernote.css'
使用的時候初始化方法:
$('#content').summernote({ height: 150, // set editable area's height codemirror: { // codemirror options theme: 'monokai' } }) $('#content').summernote('code', item.content)
獲取文本框內容:
const content = $('#content').summernote('code')
效果如下:
大功告成,大家有問題可以私信我或者直接在下方回覆