小程序原生富文本編輯組件——editor使用

小程序開放了原生的富文本編輯組件editor,功能還是挺豐富的,有興趣的大家可以看下

官方文檔:https://developers.weixin.qq.com/miniprogram/dev/component/editor.html

相關(guān)api:https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html

editor組件

使用方法的話很簡單,直接復(fù)制文檔中的示例修改下就能用了

這里提供一個方法,可以初始化editro組件的內(nèi)容

const query = wx.createSelectorQuery()

? ? ? ? query

? ? ? ? ? .select('#editorId')

? ? ? ? ? .context(function (res) {

? ? ? ? ? ? res.context.setContents({

? ? ? ? ? ? ? html: '相關(guān)內(nèi)容'

? ? ? ? ? ? })

? ? ? ? ? })

? ? ? ? ? .exec()

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容