小程序开放平台

文档中心
表单组件
button
checkbox
checkbox-group
editor
form
input
label
picker
picker-view
picker-view-column
radio
radio-group
slider
switch
textarea
基础内容
媒体组件
地图
视图容器
开放能力
画布

editor

开发
>
组件
>
表单组件
>
editor
>
更新时间:2025-04-10 15:30:05

editor

富文本

属性
类型
默认值
必填
说明
read-onlybooleanfalse设置编辑器为只读
placeholderstring提示信息
show-img-sizebooleanfalse点击图片时显示图片大小控件
show-img-toolbarbooleanfalse点击图片时显示工具栏控件
show-img-resizebooleanfalse点击图片时显示修改尺寸控件
bindreadyeventhandle编辑器初始化完成时触发
bindfocuseventhandle编辑器聚焦时触发,event.detail = {html, text, delta}
bindblureventhandle编辑器失去焦点时触发,detail = {html, text, delta}
bindinputeventhandle编辑器内容改变时触发,detail = {html, text, delta}
bindstatuschangeeventhandle通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式

Bug & tips

  1. editor
    组件在 小红书App 8.24 及之前的版本中,真机上通过chooseMedia/chooseImage选择图片路径,调用的insertImage,展示有bug,会在8.25版本修复

扫码预览

组件示例

    <editor 
      read-only="false" 
      placeholder="请输入内容..." 
      show-img-size="true" 
      show-img-toolbar="true" 
      show-img-resize="true"
      bindready="onEditorReady"
      bindfocus="onEditorFocus"
      bindblur="onEditorBlur"
      bindinput="onEditorInput"
      bindstatuschange="onStatusChange">
 </editor>
该文档是否对您有帮助?