中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
如何监听RichEditor组件选中内容时的回调?
微信扫码分享
import { JSON } from '@kit.ArkTS'; @Entry @Component struct Index { controller: RichEditorController = new RichEditorController(); options: RichEditorOptions = { controller: this.controller }; build() { Column() { RichEditor(this.options) .onReady(() => { this.controller.addTextSpan('选中此处文本,触发onselect回调。', { style: { fontColor: Color.Black, fontSize: 15 } }) }) .onSelect((value: RichEditorSelection) => { console.log("=====value:"+JSON.stringify(value)) }) .width(300) .height(50) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) } }