中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
如何创建一个使用属性字符串的RichEditor?
微信扫码分享
@Entry @Component struct Index { mutableStyledString: MutableStyledString = new MutableStyledString("创建使用属性字符串构建的RichEditor组件。", [{ start: 0, length: 5, styledKey: StyledStringKey.FONT, styledValue: this.fontStyle }]); controller: RichEditorStyledStringController = new RichEditorStyledStringController(); options: RichEditorStyledStringOptions = {controller: this.controller}; build() { Column() { RichEditor(this.options) .onReady(() => { this.controller.setStyledString(this.mutableStyledString); }) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) } }