1# 隐私遮罩 2 3用于对组件内容进行隐私遮罩处理。 4 5> **说明:** 6> 7> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 8 9 10## 属性 11 12 13| 名称 | 参数类型 | 描述 | 14| -----| ------------------------------------------ | ------------------------------------ | 15| obscured | Array<[ObscuredReasons](ts-appendix-enums.md#obscuredreasons10)> | 设置组件内容的遮罩类型。<br>默认值:[]<br/>该接口支持在ArkTS卡片中使用。<br/>仅支持[Image](ts-basic-components-image.md)组件和[Text](ts-basic-components-text.md)组件的隐私遮罩处理。<br/>**说明:**<br/>如需在图片加载过程中显示隐私遮罩,需要设置Image组件的宽度和高度。<br/>Text组件设置子组件时,不支持隐私遮罩。 | 16 17## 示例 18 19```ts 20// xxx.ets 21@Entry 22@Component 23struct ObscuredExample { 24 build() { 25 Row() { 26 Column() { 27 Text('Text not set obscured attribute').fontSize(10).fontColor(Color.Black) 28 Text('This is an example for text obscured attribute.') 29 .fontSize(30) 30 .width('600px') 31 .fontColor(Color.Black) 32 .border({ width: 1 }) 33 Text('Image not set obscured attribute').fontSize(10).fontColor(Color.Black) 34 Image($r('app.media.icon')) 35 .width('200px') 36 .height('200px') 37 Text('Text set obscured attribute').fontSize(10).fontColor(Color.Black) 38 Text('This is an example for text obscured attribute.') 39 .fontSize(30) 40 .width('600px') 41 .fontColor(Color.Black) 42 .border({ width: 1 }) 43 .obscured([ObscuredReasons.PLACEHOLDER]) 44 Text('Image set obscured attribute').fontSize(10).fontColor(Color.Black) 45 Image($r('app.media.icon')) 46 .width('200px') 47 .height('200px') 48 .obscured([ObscuredReasons.PLACEHOLDER]) 49 } 50 .width('100%') 51 } 52 .height('100%') 53 } 54} 55``` 56 57 58 59