• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 文本组件公共接口
2
3>**说明:**
4>
5>文本类组件公共接口。
6>本模块首批接口从API version 10开始支持,后续版本的新增接口,采用上角标单独标记接口的起始版本。
7
8## CaretStyle<sup>10+</sup>
9
10**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
11
12**系统能力:** SystemCapability.ArkUI.ArkUI.Full
13
14| 名称 | 类型                                   | 必填 | 说明 |
15| ------ | ------------------------------------------ | ---- | -------- |
16| width  | [Length](ts-types.md#length)               | 否   | 光标尺寸,不支持百分比。 |
17| color  | [ResourceColor](ts-types.md#resourcecolor) | 否   | 光标颜色。 |
18
19## LayoutManager<sup>12+</sup>
20
21布局管理器对象。
22
23> **说明:**
24>
25> 文本内容变更后,需等待布局完成才可获取到最新的布局信息。
26
27### 导入对象
28以Text组件为例
29```
30controller: TextController = new TextController()
31let layoutManager: LayoutManager = this.controller.getLayoutManager();
32```
33
34### getLineCount
35
36getLineCount(): number
37
38获取组件内容的总行数。
39
40**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
41
42**系统能力:** SystemCapability.ArkUI.ArkUI.Full
43
44**返回值:**
45
46| 类型     | 说明        |
47| ------ | --------- |
48| number | 组件内容的总行数。 |
49
50### getGlyphPositionAtCoordinate
51
52getGlyphPositionAtCoordinate(x: number, y: number): PositionWithAffinity
53
54获取较为接近给定坐标的字形的位置信息。
55
56**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
57
58**系统能力:** SystemCapability.ArkUI.ArkUI.Full
59
60**参数:**
61
62| 参数名    | 类型   | 必填   | 说明                 |
63| ------ | ------ | ---- | -------------------- |
64| x | number | 是    | 相对于组件的横坐标,单位px |
65| y | number | 是    | 相对于组件的纵坐标,单位px |
66
67**返回值:**
68
69| 类型                                          | 说明        |
70| --------------------------------------------- | ----------- |
71| [PositionWithAffinity](#positionwithaffinity12) | 字形位置信息。|
72
73### getLineMetrics
74
75getLineMetrics(lineNumber: number): LineMetrics
76
77获取指定行的行信息、文本样式信息、以及字体属性信息。
78
79**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
80
81**系统能力:** SystemCapability.ArkUI.ArkUI.Full
82
83**参数:**
84
85| 参数名    | 类型   | 必填   | 说明                 |
86| ------ | ------ | ---- | -------------------- |
87| lineNumber | number | 是    | 行号。从0开始。 |
88
89**返回值:**
90
91| 类型                                       | 说明       |
92| ---------------------------------------- | -------- |
93| [LineMetrics](../../apis-arkgraphics2d/js-apis-graphics-text.md#linemetrics) | 行信息、文本样式信息、以及字体属性信息。 |
94
95## PositionWithAffinity<sup>12+</sup>
96
97位置以及亲和度。
98
99**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
100
101**系统能力:** SystemCapability.ArkUI.ArkUI.Full
102
103| 名称      | 类型                   | 只读 | 可选 | 说明                      |
104| --------- | --------------------- | ---- | ---- | ------------------------ |
105| position  | number                | 是   | 否   | 字形相对于组件内容的索引,整数。  |
106| affinity  | [Affinity](../../apis-arkgraphics2d/js-apis-graphics-text.md#affinity) | 是   | 是   | 位置亲和度。             |
107
108## TextMenuItemId<sup>12+</sup>
109
110菜单的Id值。
111
112**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
113
114**系统能力:** SystemCapability.ArkUI.ArkUI.Full
115
116### 属性
117
118**系统能力:** SystemCapability.ArkUI.ArkUI.Full
119
120| 名称           | 类型              | 只读   | 可选  | 说明     |
121| ------------ |---------------------| ---- | ---- | ------ |
122| CUT  | [TextMenuItemId](#textmenuitemid12) |  是  |  是 | 默认裁剪。<br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 |
123| COPY  | [TextMenuItemId](#textmenuitemid12) |  是  |  是  | 默认复制。<br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 |
124| PASTE | [TextMenuItemId](#textmenuitemid12)   | 是    | 是    | 默认粘贴。<br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 |
125| SELECT_ALL   | [TextMenuItemId](#textmenuitemid12)   | 是    | 是    | 默认全选。<br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 |
126| COLLABORATION_SERVICE   | [TextMenuItemId](#textmenuitemid12)   | 是    | 是    | 互通服务。<br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 |
127| CAMERA_INPUT   | [TextMenuItemId](#textmenuitemid12)   | 是    | 是   | 拍摄输入。<br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 |
128| AI_WRITER<sup>13+</sup>   | [TextMenuItemId](#textmenuitemid12)   | 是    | 是    | 可对选中的文本进行润色、摘要提取、排版等。该菜单项依赖大模型能力,否则不生效。<br/>**原子化服务API:** 从API version 13开始,该接口支持在原子化服务中使用。 |
129
130### of
131
132static of(id: ResourceStr): TextMenuItemId
133
134根据id创建TextMenuItemId。
135
136**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
137
138**系统能力:** SystemCapability.ArkUI.ArkUI.Full
139
140**参数:**
141
142| 参数名  | 类型                              | 必填 | 说明                                                         |
143| ------- | --------------------------------- | ---- | ------------------------------------------------------------ |
144| id | [ResourceStr](ts-types.md#resourcestr) | 是   | 菜单的id。 |
145
146**返回值:**
147
148| 类型              |       说明       |
149| ------- | --------------------------------- |
150| [TextMenuItemId](#textmenuitemid12) | TextMenuItemId的对象。 |
151
152### equals
153
154equals(id: TextMenuItemId): boolean
155
156判断TextMenuItemId是否相等。
157
158**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
159
160**系统能力:** SystemCapability.ArkUI.ArkUI.Full
161
162**参数:**
163
164| 参数名  | 类型                              | 必填 | 说明                                                         |
165| ------- | --------------------------------- | ---- | ------------------------------------------------------------ |
166| id | [TextMenuItemId](#textmenuitemid12) | 是   | TextMenuItemId的id。 |
167
168**返回值:**
169
170| 类型              |       说明       |
171| ------- | --------------------------------- |
172| boolean | 两个TextMenuItemId是否相等。 |
173
174## TextMenuItem<sup>12+</sup>对象说明
175
176**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
177
178**系统能力:** SystemCapability.ArkUI.ArkUI.Full
179
180| 名称  | 类型                              | 必填 | 说明   |
181| ------- | --------------------------------- | ---- | --------------------------------- |
182| content | [ResourceStr](ts-types.md#resourcestr) | 是   | 菜单名称。 |
183| icon | [ResourceStr](ts-types.md#resourcestr) | 否   | 菜单图标。<br/>不支持网络图片。 |
184| id | [TextMenuItemId](#textmenuitemid12) | 是   | 菜单id。 |
185
186## EditMenuOptions对象说明
187
188**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
189
190**系统能力:** SystemCapability.ArkUI.ArkUI.Full
191
192### onCreateMenu<sup>12+</sup>
193
194onCreateMenu(menuItems: Array\<TextMenuItem>): Array\<TextMenuItem>
195
196菜单数据模版编辑能力。
197
198**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
199
200**系统能力:** SystemCapability.ArkUI.ArkUI.Full
201
202**参数:**
203
204| 参数名  | 类型                              | 必填 | 说明   |
205| ------- | --------------------------------- | ---- | --------------------------------- |
206| menuItems | Array<[TextMenuItem](#textmenuitem12对象说明)> | 是   | 菜单项。<br/>**说明:** <br/>对默认菜单项的名称修改不生效。 |
207
208**返回值:**
209
210| 类型              |       说明       |
211| ------- | --------------------------------- |
212| Array\<[TextMenuItem](#textmenuitem12对象说明)> | 设置的菜单项。<br/>**说明:** <br/>不返回系统默认菜单项的图标。 |
213
214### onMenuItemClick<sup>12+</sup>
215
216onMenuItemClick(menuItem: TextMenuItem, range: TextRange): boolean
217
218菜单项功能函数。
219
220**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
221
222**系统能力:** SystemCapability.ArkUI.ArkUI.Full
223
224**参数:**
225
226| 参数名  | 类型                              | 必填 | 说明   |
227| ------- | --------------------------------- | ---- | --------------------------------- |
228| menuItem | [TextMenuItem](#textmenuitem12对象说明) | 是   | 菜单项。 |
229| range | [TextRange](#textrange12) | 是   | 选中的文本信息。 |
230
231**返回值:**
232
233| 类型              |       说明       |
234| ------- | --------------------------------- |
235| boolean | 菜单项的执行逻辑。<br/>返回为true,拦截系统默认逻辑,仅执行自定义逻辑。<br/>返回为false,先执行自定义逻辑,再执行系统逻辑。 |
236
237## TextRange<sup>12+</sup>
238
239文本范围。
240
241**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
242
243**系统能力:** SystemCapability.ArkUI.ArkUI.Full
244
245### 属性
246
247| 名称 | 类型 | 必填 | 说明 |
248| -- | -- | -- | -- |
249| start | number | 否 | 起始索引。 |
250| end | number | 否 | 结束索引。 |
251
252## EditableTextOnChangeCallback<sup>12+</sup>
253
254type EditableTextOnChangeCallback = (value: string, previewText?: PreviewText) => void
255
256输入内容发生变化时,触发该回调。
257
258**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
259
260**系统能力:** SystemCapability.ArkUI.ArkUI.Full
261
262**参数:**
263
264| 参数名 | 类型 | 必填 | 说明 |
265| -- | -- | -- | -- |
266| value | string | 是 | 文本框内正式上屏的文本内容。 |
267| previewText | [PreviewText](#previewtext12) | 否 | 预上屏文本信息,包含预上屏起始位置和文本内容。 |
268
269## TextDataDetectorType<sup>11+</sup>枚举说明
270
271**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
272
273**系统能力:** SystemCapability.ArkUI.ArkUI.Full
274
275| 名称  | 说明                               |
276| ----- | -------------------------------------- |
277| PHONE_NUMBER  | 电话号码 |
278| URL | 链接 |
279| EMAIL | 邮箱 |
280| ADDRESS | 地址 |
281| DATE_TIME<sup>12+</sup> | 时间 |
282
283## TextDeleteDirection<sup>12+</sup>枚举说明
284
285定义删除文本方向。
286
287**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
288
289**系统能力:** SystemCapability.ArkUI.ArkUI.Full
290
291| 名称    | 值   | 说明                        |
292| ------- | ---- | ---------------------------------- |
293| BACKWARD | 0    | 向后删除。 |
294| FORWARD    | 1    | 向前删除。 |
295
296## MenuType<sup>13+</sup>枚举说明
297
298菜单类型。
299
300**原子化服务API:** 从API version 13开始,该接口支持在原子化服务中使用。
301
302**系统能力:** SystemCapability.ArkUI.ArkUI.Full
303
304| 名称 | 值 | 说明 |
305| ------- | ---- | ------------------- |
306| SELECTION_MENU | 0 | 文本选择菜单。|
307| PREVIEW_MENU | 1 | 图片预览菜单。|
308
309## InsertValue<sup>12+</sup>对象说明
310
311**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
312
313**系统能力:** SystemCapability.ArkUI.ArkUI.Full
314
315| 名称    | 类型                          | 必填 | 说明                                                         |
316| ------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
317| insertOffset  | number | 是   | 插入的值的位置信息。 |
318| insertValue  | string | 是   | 插入的值。 |
319
320## DeleteValue<sup>12+</sup>对象说明
321
322**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
323
324**系统能力:** SystemCapability.ArkUI.ArkUI.Full
325
326| 名称    | 类型                                                    | 必填 | 说明                                                    |
327| ------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
328| deleteOffset  | number | 是   | 删除的值的位置信息。 |
329| direction  | [TextDeleteDirection](#textdeletedirection12枚举说明) | 是   | 删除值的方向。 |
330| deleteValue  | string | 是   | 删除的值。 |
331
332## TextDataDetectorConfig<sup>11+</sup>对象说明
333
334**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
335
336**系统能力:** SystemCapability.ArkUI.ArkUI.Full
337
338| 名称 | 类型  | 必填 | 说明  |
339| ------ | -------- | ---- | ------------------------------------------- |
340| types   | [TextDataDetectorType](ts-text-common.md#textdatadetectortype11枚举说明)[] | 是   | 设置文本识别的实体类型。设置types为null或者[]时,识别所有类型的实体,否则只识别指定类型的实体。 |
341| onDetectResultUpdate   | (result: string) => void | 否   | 文本识别成功后,触发onDetectResultUpdate回调。<br/>-&nbsp;result:文本识别的结果,Json格式。 |
342| color<sup>12+</sup>   | [ResourceColor](ts-types.md#resourcecolor) | 否   | 设置文本识别成功后的实体颜色。<br/>默认值:'#ff0a59f7' |
343| decoration<sup>12+</sup>  | [DecorationStyleInterface](ts-universal-styled-string.md#decorationstyleinterface对象说明)| 否   | 设置文本识别成功后的实体装饰线样式。<br/>默认值:<br/>{<br/>&nbsp;type:&nbsp;TextDecorationType.Underline,<br/>&nbsp;color:&nbsp;与实体颜色一致,<br/>&nbsp;style:&nbsp;TextDecorationStyle.SOLID&nbsp;<br/>} |
344## PreviewText<sup>12+</sup>
345
346预上屏信息。
347
348**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
349
350**系统能力:** SystemCapability.ArkUI.ArkUI.Full
351
352| 名称     | 类型                                             | 必填 | 说明                                                     |
353| -------- | ------------------------------------------------ | ---- | -------------------------------------------------------- |
354| offset | number | 是   | 预上屏内容的起始位置。 |
355| value    | string         | 是   | 预上屏的内容。         |
356
357## FontSettingOptions<sup>12+</sup>对象说明
358
359字体配置项。
360
361**卡片能力:** 从API version 12开始,该接口支持在ArkTS卡片中使用。
362
363**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
364
365**系统能力:** SystemCapability.ArkUI.ArkUI.Full
366
367| 名称     | 类型                                             | 必填 | 说明                                                     |
368| -------- | ------------------------------------------------ | ---- | -------------------------------------------------------- |
369| enableVariableFontWeight | boolean | 否   | 是否支持字重无极调节。 |
370
371## OnDidChangeCallback<sup>12+</sup>
372
373type OnDidChangeCallback = (rangeBefore: TextRange, rangeAfter: TextRange) => void
374
375文本变换后回调。
376
377**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
378
379**系统能力:** SystemCapability.ArkUI.ArkUI.Full
380
381**参数:**
382
383| 参数名 | 类型 | 必填 | 说明 |
384| -- | -- | -- | -- |
385| rangeBefore | [TextRange](ts-universal-attributes-text-style.md#textrange12) | 是 | 文本变化前将要被替换的文本范围。 |
386| rangeAfter | [TextRange](ts-universal-attributes-text-style.md#textrange12) | 是 | 文本变化后新增内容的文本范围。 |
387
388## StyledStringChangedListener<sup>12+</sup>
389
390属性字符串的文本内容变化监听器。
391
392**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
393
394**系统能力:** SystemCapability.ArkUI.ArkUI.Full
395
396| 名称 | 类型 | 必填 | 说明 |
397| -- | -- | -- | -- |
398| onWillChange | Callback<[StyledStringChangeValue](ts-basic-components-richeditor.md#styledstringchangevalue12), boolean> | 否 | 文本内容将要变化回调函数。 |
399| onDidChange | [OnDidChangeCallback](#ondidchangecallback12) | 否 | 文本内容完成变化回调函数。 |
400
401## StyledStringChangeValue<sup>12+</sup>
402
403属性字符串的文本变化信息。
404
405**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
406
407**系统能力:** SystemCapability.ArkUI.ArkUI.Full
408
409| 名称 | 类型 | 必填 | 说明 |
410| -- | -- | -- | -- |
411| range | TextRange | 是 | 即将被替换的属性字符串子串在原字符串中的范围。 |
412| replacementString | [StyledString](ts-universal-styled-string.md#styledstring) | 是 | 用于替换的属性字符串。 |
413| previewText | [StyledString](ts-universal-styled-string.md#styledstring) | 否 | 预览样式字符串。 |
414
415## TextBaseController<sup>12+</sup>
416
417文本选择控制器。
418
419**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
420
421**系统能力:** SystemCapability.ArkUI.ArkUI.Full
422
423### setSelection<sup>12+</sup>
424
425setSelection(selectionStart:&nbsp;number, selectionEnd:&nbsp;number, options?:&nbsp;SelectionOptions): void
426
427支持设置组件内的内容选中,选中部分背板高亮。
428
429selectionStart和selectionEnd均为-1时表示全选。
430
431未获焦时调用该接口不产生选中效果。
432
433从API version 12开始,在2in1设备中,无论options取何值,调用setSelection接口都不会弹出菜单,此外,如果组件中已经存在菜单,调用setSelection接口会关闭菜单。
434
435在非2in1设备中,options取值为MenuPolicy.DEFAULT时,遵循以下规则:
436
4371. 组件内有手柄菜单时,接口调用后不关闭菜单,并且调整菜单位置。
438
4392. 组件内有不带手柄的菜单时,接口调用后不关闭菜单,并且菜单位置不变。
440
4413. 组件内无菜单时,接口调用后也无菜单显示。
442
443**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
444
445**系统能力:** SystemCapability.ArkUI.ArkUI.Full
446
447**参数:**
448
449| 参数名            | 类型   | 必填   | 说明    |
450| -------------- | ------ | ---- | ------- |
451| selectionStart | number | 是    | 选中开始位置。 |
452| selectionEnd   | number | 是    | 选中结束位置。 |
453| options<sup>12+</sup>   | [SelectionOptions](ts-types.md#selectionoptions12对象说明) | 否    | 选择项配置。 |
454
455### closeSelectionMenu<sup>12+</sup>
456
457closeSelectionMenu(): void
458
459关闭自定义选择菜单或系统默认选择菜单。
460
461**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
462
463**系统能力:** SystemCapability.ArkUI.ArkUI.Full
464
465### getLayoutManager<sup>12+</sup>
466
467getLayoutManager(): LayoutManager
468
469获取布局管理器对象。
470
471**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
472
473**系统能力:** SystemCapability.ArkUI.ArkUI.Full
474
475**返回值:**
476
477| 类型                                       | 说明      |
478| ---------------------------------------- | ------- |
479| [LayoutManager](ts-text-common.md#LayoutManager) | 布局管理器对象。 |
480
481## TextEditControllerEx<sup>12+</sup>
482
483文本扩展编辑控制器。
484
485继承自[TextBaseController](#textbasecontroller12)。
486
487**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
488
489**系统能力:** SystemCapability.ArkUI.ArkUI.Full
490
491### isEditing<sup>12+</sup>
492
493isEditing(): boolean
494
495获取当前富文本的编辑状态。
496
497**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
498
499**系统能力:** SystemCapability.ArkUI.ArkUI.Full
500
501**返回值:**
502
503| 类型    | 说明                          |
504| ------- | ----------------------------- |
505| boolean | true为编辑态,false为非编辑态。 |
506
507### stopEditing<sup>12+</sup>
508
509stopEditing(): void
510
511退出编辑态。
512
513**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
514
515**系统能力:** SystemCapability.ArkUI.ArkUI.Full
516
517### getCaretOffset<sup>12+</sup>
518
519getCaretOffset(): number
520
521返回当前光标所在位置。
522
523**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
524
525**系统能力:** SystemCapability.ArkUI.ArkUI.Full
526
527**返回值:**
528
529| 类型     | 说明        |
530| ------ | --------- |
531| number | 当前光标所在位置。 |
532
533### setCaretOffset<sup>12+</sup>
534
535setCaretOffset(offset: number): boolean
536
537设置光标位置。
538
539**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
540
541**系统能力:** SystemCapability.ArkUI.ArkUI.Full
542
543**参数:**
544
545| 参数名    | 类型   | 必填   | 说明                |
546| ------ | ------ | ---- | -------------------- |
547| offset | number | 是    | 光标偏移位置。超出所有内容范围时,设置失败。 |
548
549**返回值:**
550
551| 类型      | 说明        |
552| ------- | --------- |
553| boolean | 光标是否设置成功。 |
554
555### getPreviewText<sup>12+</sup>
556
557getPreviewText?(): PreviewText
558
559获取预上屏信息。
560
561**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
562
563**系统能力:** SystemCapability.ArkUI.ArkUI.Full
564
565**返回值:**
566
567| 类型                                       | 说明      |
568| ---------------------------------------- | ------- |
569| [PreviewText](#previewtext12) | 预上屏信息。 |.
570
571## StyledStringController<sup>12+</sup>
572
573定义StyledString控制器。
574
575**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
576
577**系统能力:** SystemCapability.ArkUI.ArkUI.Full
578
579### setStyledString<sup>12+</sup>
580
581setStyledString(styledString: StyledString): void
582
583设置富文本组件显示的属性字符串。
584
585**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
586
587**系统能力:** SystemCapability.ArkUI.ArkUI.Full
588
589**参数:**
590
591| 参数名   | 类型   | 必填   | 说明                |
592| ----- | ------ | ---- | ------------------- |
593| styledString | [StyledString](ts-universal-styled-string.md#styledstring) | 是    | 属性字符串。<br/>**说明:** <br/>StyledString的子类[MutableStyledString](ts-universal-styled-string.md#mutablestyledstring)也可以作为入参值。 |
594
595### getStyledString<sup>12+</sup>
596
597getStyledString(): MutableStyledString;
598
599获取富文本组件显示的属性字符串。
600
601**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
602
603**系统能力:** SystemCapability.ArkUI.ArkUI.Full
604
605**返回值:**
606
607| 类型    | 说明                          |
608| ------- | ----------------------------- |
609| [MutableStyledString](ts-universal-styled-string.md#mutablestyledstring) | 富文本组件显示的属性字符串 |
610
611## DecorationStyleResult<sup>12+</sup>
612
613后端返回的文本装饰线样式信息。
614
615**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
616
617**系统能力:** SystemCapability.ArkUI.ArkUI.Full
618
619| 名称  | 类型                              | 必填 | 说明   |
620| ------- | --------------------------------- | ---- | --------------------------------- |
621| type | [TextDecorationType](ts-appendix-enums.md#textdecorationtype) | 是   | 装饰线类型。 |
622| color | [ResourceColor](ts-types.md#resourcecolor) | 是   | 装饰线颜色。 |
623| style | [TextDecorationStyle](ts-appendix-enums.md#textdecorationstyle12) | 否   | 装饰线样式。 |