中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
如何向RichEditor中添加SymbolSpan?
微信扫码分享
@Entry @Component struct Index { my_builder: CustomBuilder|undefined = undefined; controller: RichEditorController = new RichEditorController(); options: RichEditorOptions = { controller: this.controller }; build() { Column() { RichEditor(this.options) .onReady(() => { this.controller.addTextSpan('点击按钮在此处添加symbol。', { style: { fontColor: Color.Black, fontSize: 15 } }) }) .width(300) .height(100) Button('addSymbolSpan', { buttonStyle: ButtonStyleMode.NORMAL }) .height(30) .fontSize(13) .onClick(() => { this.controller.addSymbolSpan($r("sys.symbol.basketball_fill"), { style: { fontSize: 30 } }) }) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) } }