diff --git a/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md b/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md index 98edd3bbf8531521f9411cb8f8c4eeda5f54b71d..f0170225f5477a10ef542eb4ba8f48af423c1fac 100644 --- a/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md +++ b/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md @@ -49,7 +49,6 @@ - [半模态转场](ts-universal-attributes-sheet-transition.md) - [隐私遮罩](ts-universal-attributes-obscured.md) - [文本通用](ts-universal-attributes-text-style.md) - - [安全控件通用](ts-universal-attributes-securitycomponent.md) - 手势处理 - [绑定手势方法](ts-gesture-settings.md) - 基础手势 @@ -92,9 +91,6 @@ - [RichText](ts-basic-components-richtext.md) - [ScrollBar](ts-basic-components-scrollbar.md) - [Search](ts-basic-components-search.md) - - [SecLocationButton](ts-basic-components-seclocationbutton.md) - - [SecPasteButton](ts-basic-components-secpastebutton.md) - - [SecSaveButton](ts-basic-components-secsavebutton.md) - [Select](ts-basic-components-select.md) - [Slider](ts-basic-components-slider.md) - [Span](ts-basic-components-span.md) @@ -185,4 +181,4 @@ - 已停止维护的组件 - [GridContainer](ts-container-gridcontainer.md) - 已停止维护的接口 - - [点击控制](ts-universal-attributes-click.md) \ No newline at end of file + - [点击控制](ts-universal-attributes-click.md) diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/seclocationbutton1.png b/zh-cn/application-dev/reference/arkui-ts/figures/seclocationbutton1.png deleted file mode 100644 index acaa811077eec62791dcfefd3acfd6fc9f9b18d6..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/seclocationbutton1.png and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/secpastebutton1.png b/zh-cn/application-dev/reference/arkui-ts/figures/secpastebutton1.png deleted file mode 100644 index 41a2510def2bdd21aaa1b6a6d74122d7857b0351..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/secpastebutton1.png and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/secsavebutton1.png b/zh-cn/application-dev/reference/arkui-ts/figures/secsavebutton1.png deleted file mode 100644 index a9d96dcb1c6082a329f87126d5dbc6678b2a3e41..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/secsavebutton1.png and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/securitycomponent1.png b/zh-cn/application-dev/reference/arkui-ts/figures/securitycomponent1.png deleted file mode 100644 index 21409ff9b6699683e2aba8dbbee453ca87defc6b..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/securitycomponent1.png and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-seclocationbutton.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-seclocationbutton.md deleted file mode 100644 index 02d7bd582e91696fa0b78d48245647ad159b98c2..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-seclocationbutton.md +++ /dev/null @@ -1,172 +0,0 @@ -# SecLocationButton - -安全组件的位置按钮,用户通过点击该位置按钮,可以临时获取精准定位权限,而不需要权限弹框授权确认。 - -> **说明:** -> -> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - -## 子组件 - -不支持。 - -## 接口 - -**方法1:** SecLocationButton() - -默认创建带有图标、文本、背景的位置按钮。 - -**方法2:** SecLocationButton(option:{icon?: LocationIconStyle, text?: LocationDescription, background?: BackgroundButtonType}) - -创建包含指定元素的位置按钮。 - -**参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| ------ | ----------------------------------- | ---- | -------------- | -| icon | [LocationIconStyle](#locationiconstyle枚举说明) |否 | 设置位置按钮的图标风格
不传入该参数表示没有图标,icon和text至少存在一个。 | -| text | [LocationDescription](#locationdescription枚举说明) | 否 | 设置位置按钮的文本描述
不传入该参数表示没有文字描述,icon和text至少存在一个。 | -| background | [BackgroundButtonType](#backgroundbuttontype枚举说明) | 否 | 设置位置按钮的背景样式
不传入该参数表示没有背景。 | - -## LocationIconStyle枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| FULL_FILLED | 位置按钮展示填充样式图标。 | -| LINES | 位置按钮展示线条样式图标。 | - -## LocationDescription枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| CURRENT_LOCATION | 位置按钮的文字描述为“当前位置”。 | -| ADD_LOCATION | 位置按钮的文字描述为“添加位置”。 | -| SELECT_LOCATION | 位置按钮的文字描述为“选择位置”。 | -| SHARE_LOCATION | 位置按钮的文字描述为“共享位置”。 | -| SEND_LOCATION | 位置按钮的文字描述为“发送位置”。 | -| LOCATING | 位置按钮的文字描述为“定位”。 | -| LOCATION | 位置按钮的文字描述为“位置”。 | -| SEND_CURRENT_LOCATION | 位置按钮的文字描述为“发送实时位置”。 | -| RELOCATION | 位置按钮的文字描述为“重定位”。 | -| PUNCH_IN | 位置按钮的文字描述为“打卡定位”。 | -| CURRENT_POSITION | 位置按钮的文字描述为“所在位置”。 | - -## BackgroundButtonType枚举说明 -| 名称 | 描述 | -| ------------------- | ------------------ | -| CAPSULE_BACKGROUND | 位置按钮的背景样式为胶囊状。 | -| CIRCLE_BACKGROUND | 位置按钮的背景样式为圆状。 | -| NORMAL_BACKGROUND | 位置按钮的背景样式为矩形。 | - -## SecLocationButtonLayoutOrder枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| ICON_FIRST | 图标的排列顺序先于文字。 | -| TEXT_FIRST | 文字的排列顺序先于图标。 | - -## SecLocationButtonLayoutDirection枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| HORIZONTAL | 位置按钮上图标和文字分布的方向为水平排列。 | -| VERTICAL | 位置按钮上图标和文字分布的方向为垂直排列。 | - -## SecLocationButtonOnClickResult枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| LOCATION_BUTTON_CLICK_SUCCESS | 位置按钮点击成功。 | -| LOCATION_BUTTON_CLICK_GRANT_FAILED | 位置按钮点击后位置权限授权失败。 | - -## 属性 - -不支持通用属性,仅支持以下属性: - -| 名称 | 参数类型 | 必填 | 描述 | -| ----------- | ------ | ---- | ---------------------------------------- | -| iconSize | [Length](ts-types.md#length) | 否 | 设置位置按钮上图标的尺寸。
默认值:16vp | -| layoutDirection | [SecLocationButtonLayoutDirection](#seclocationbuttonlayoutdirection枚举说明) | 否 | 设置位置按钮上图标和文字分布的方向。
默认值:SecLocationButtonLayoutDirection.HORIZONTAL| -| layoutOrder | [SecLocationButtonLayoutOrder](#seclocationbuttonlayoutorder枚举说明) | 否 | 设置位置按钮上图标和文字分布的顺序。
默认值:SecLocationButtonLayoutOrder.ICON_FIRST| -| position | [Position](ts-types.md#position8) | 否 | 设置绝对定位,设置位置按钮的左上角相对于父容器左上角的偏移位置。
默认值:
{
x: 0,
y: 0
}| -| markAnchor | [Position](ts-types.md#position8) | 否 | 设置绝对定位的锚点,以位置按钮的左上角作为基准点进行偏移。
默认值:
{
x: 0,
y: 0
}|| -| offset | [Position](ts-types.md#position8) | 否 | 设置相对定位,位置按钮相对于自身的偏移量。
默认值:
{
x: 0,
y: 0
}|| -| fontSize | [Length](ts-types.md#length) | 否 | 设置位置按钮上文字的尺寸。
默认值:16fp | -| fontStyle | [FontStyle](ts-appendix-enums.md#fontstyle) | 否 | 设置位置按钮上文字的样式。
默认值:FontStyle.Normal | -| fontWeight | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string | 否 | 设置位置按钮上文字粗细。
默认值:FontWeight.Medium | -| fontFamily | string \| [Resource](ts-types.md#resource类型) | 否 | 设置位置按钮上文字的字体。
默认字体:'HarmonyOS Sans' | -| fontColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置位置按钮上文字的颜色。
默认值:#ffffffff | -| iconColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置位置按钮上图标的颜色。
默认值:#ffffffff | -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置位置按钮的背景颜色。
默认值:#007dff | -| borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) | 否 | 设置位置按钮的边框的样式。
默认不设置边框样式 | -| borderWidth | [Length](ts-types.md#length) | 否 | 设置位置按钮的边框的宽度。
默认不设置边框宽度 | -| borderColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置位置按钮的边框的颜色。
默认不设置边框颜色 | -| borderRadius | [Length](ts-types.md#length) | 否 | 设置位置按钮的边框圆角半径。
默认值:1/2 按钮整高 | -| backgroundPadding | [Padding](ts-types.md#padding) \| [Length](ts-types.md#length) | 否 | 设置位置按钮的内边距。
默认值:上下8vp, 左右24vp | -| textIconPadding | [Length](ts-types.md#length) | 否 | 设置位置按钮中图标和文字的间距。
默认值:4vp | - - -## 事件 - -不支持通用事件,仅支持以下事件: - -| 名称 | 功能描述 | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| onClick((result: [SecLocationButtonOnClickResult](#seclocationbuttononclickresult枚举说明), event?: [ClickEvent](ts-universal-events-click.md#clickevent对象说明)) => void) | 点击动作触发该回调。
result:位置权限的授权结果。
event:见ClickEvent对象说明。 | - -## 示例 - -```ts -// xxx.ets -@Entry -@Component -struct Index { - build() { - Row() { - Column({space:10}) { - // 默认位置按钮 - SecLocationButton() - // 生成默认位置按钮,包含图标+文字+背景 - SecLocationButton() - .fontSize(35) - .fontColor(Color.White) - .iconSize(30) - .layoutDirection(SecLocationButtonLayoutDirection.HORIZONTAL) - .layoutOrder(SecLocationButtonLayoutOrder.TEXT_FIRST) - .borderWidth(1) - .borderStyle(BorderStyle.Dashed) - .borderColor(Color.Blue) - .borderRadius(20) - .fontWeight(100) - .iconColor(Color.White) - .backgroundPadding({ left: 50, top: 50, bottom: 50, right: 50 }) - .textIconPadding(20) - .backgroundColor(0x3282f6) - .onClick((result: SecLocationButtonOnClickResult) => { - console.error("result " + result) - }) - // 生成定制图标、文字、背景的位置按钮 - SecLocationButton({icon:LocationIconStyle.LINES, text:LocationDescription.CURRENT_POSITION, background:BackgroundButtonType.NORMAL_BACKGROUND}) - .fontSize(35) - .fontColor(0x3282f6) - .iconSize(30) - .layoutDirection(SecLocationButtonLayoutDirection.VERTICAL) - .layoutOrder(SecLocationButtonLayoutOrder.ICON_FIRST) - .borderWidth(1) - .borderStyle(BorderStyle.Dashed) - .borderColor(0x9ffcfd) - .borderRadius(20) - .fontWeight(100) - .iconColor(0x3282f6) - .backgroundPadding({left:50, top:50, bottom:50, right:50}) - .textIconPadding(20) - .backgroundColor(0x9ffcfd) - .onClick((result: SecLocationButtonOnClickResult)=>{ - console.error("result " + result) - }) - }.width('100%') - }.height('100%') - } -} -``` - -![seclocatonbutton1](figures/seclocationbutton1.png) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-secpastebutton.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-secpastebutton.md deleted file mode 100644 index aa05bdee29c14a3054fc66c03d3f08037f6e71ef..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-secpastebutton.md +++ /dev/null @@ -1,85 +0,0 @@ -# SecPasteButton - -安全组件的粘贴按钮,用户通过点击该粘贴按钮,可以临时获取读取剪贴板权限,而不会触发toast提示。 - -> **说明:** -> -> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - -## 子组件 - -不支持。 - -## 接口 - -**方法1:** SecPasteButton() - -默认创建带有图标、文本、背景的粘贴按钮。 - -**方法2:** SecPasteButton(option:{icon?: PasteIconStyle, text?: PasteDescription, buttonType?: ButtonType}) - -创建包含指定元素的粘贴按钮。 - -**参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| ------ | ----------------------------------- | ---- | -------------- | -| icon | [PasteIconStyle](#pasteiconstyle枚举说明) |否 | 设置粘贴按钮的图标风格。
不传入该参数表示没有图标,icon和text至少存在一个。 | -| text | [PasteDescription](#pastedescription枚举说明) | 否 | 设置粘贴按钮的文本描述。
不传入该参数表示没有文字描述,icon和text至少存在一个。 | -| buttonType | [ButtonType](ts-basic-components-button.md#ButtonType枚举说明) | 否 | 设置粘贴按钮的背景样式。
不传入该参数表示没有背景。 | - -## 属性 - -不支持通用属性,仅继承[安全组件通用属性](ts-universal-attributes-securitycomponent.md#属性)。 - -## PasteIconStyle枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| LINES | 粘贴按钮展示线条样式图标。 | - -## PasteDescription枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| PASTE | 粘贴按钮的文字描述为“粘贴”。 | - -## SecPasteButtonOnClickResult枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| SUCCESS | 粘贴按钮点击成功。 | -| TEMPORARY_AUTHORIZATION_FAILED | 粘贴按钮点击后权限授权失败。 | - -## 事件 - -不支持通用事件,仅支持以下事件: - -| 名称 | 功能描述 | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| onClick((result: [SecPasteButtonOnClickResult](#secpastebuttononclickresult枚举说明), event?: [ClickEvent](ts-universal-events-click.md#clickevent对象说明)) => void) | 点击动作触发该回调。
result:剪贴板权限的授权结果,授权后可以读取当前剪贴板内容,如果内容发生变化再次读取仍需授权。
event:见ClickEvent对象说明。 | - -## 示例 - -```ts -// xxx.ets -@Entry -@Component -struct Index { - build() { - Row() { - Column({space:10}) { - // 默认参数下,图标、文字、背景都存在 - SecPasteButton() - // 传入参数即表示元素存在,不传入的参数表示元素不存在,例如:只显示图标 - SecPasteButton({icon:PasteIconStyle.LINES}) - // 只显示图标+背景 - SecPasteButton({icon:PasteIconStyle.LINES, buttonType:ButtonType.Capsule}) - // 图标、文字、背景都存在 - SecPasteButton({icon:PasteIconStyle.LINES, text:PasteDescription.PASTE, buttonType:ButtonType.Capsule}) - }.width('100%') - }.height('100%') - } -} -``` - -![SecPasteButton1](figures/secpastebutton1.png) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-secsavebutton.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-secsavebutton.md deleted file mode 100644 index bc017f5fdd45a6e8ff72b15a51292768969f988a..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-secsavebutton.md +++ /dev/null @@ -1,93 +0,0 @@ -# SecSaveButton - -安全组件的保存按钮,用户通过点击该保存按钮,可以临时获取存储权限,而不需要权限弹框授权确认。 - -> **说明:** -> -> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - -## 子组件 - -不支持。 - -## 接口 - -**方法1:** SecSaveButton() - -默认创建带有图标、文本、背景的保存按钮。 - -**方法2:** SecSaveButton(option:{icon?: SaveIconStyle, text?: SaveDescription, buttonType?: ButtonType}) - -创建包含指定元素的保存按钮。 - -**参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| ------ | ----------------------------------- | ---- | -------------- | -| icon | [SaveIconStyle](#saveiconstyle枚举说明) |否 | 设置保存按钮的图标风格
不传入该参数表示没有图标,icon和text至少存在一个。 | -| text | [SaveDescription](#savedescription枚举说明) | 否 | 设置保存按钮的文本描述
不传入该参数表示没有文字描述,icon和text至少存在一个。 | -| buttonType | [ButtonType](ts-basic-components-button.md#ButtonType枚举说明) | 否 | 设置保存按钮的背景样式
不传入该参数表示没有背景。 | - -## SaveIconStyle枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| FULL_FILLED | 保存按钮展示填充样式图标。 | -| LINES | 保存按钮展示线条样式图标。 | - -## SaveDescription枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| DOWNLOAD | 保存按钮的文字描述为“下载”。 | -| DOWNLOAD_FILES | 保存按钮的文字描述为“下载文件”。 | -| SAVE | 保存按钮的文字描述为“保存”。 | -| SAVE_IMAGES | 保存按钮的文字描述为“保存图片”。 | -| SAVE_FILES | 保存按钮的文字描述为“保存文件”。 | -| DOWNLOAD_AND_SHARE | 保存按钮的文字描述为“下载分享”。 | -| RECEIVE | 保存按钮的文字描述为“接收”。 | -| CONTINUE_TO_RECEIVE | 保存按钮的文字描述为“继续接收”。 | - -## SecSaveButtonOnClickResult枚举说明 - -| 名称 | 描述 | -| ------------------- | ------------------ | -| SUCCESS | 保存按钮点击成功。 | -| TEMPORARY_AUTHORIZATION_FAILED | 保存按钮点击后权限授权失败。 | - -## 属性 - -不支持通用属性,仅继承[安全组件通用属性](ts-universal-attributes-securitycomponent.md#属性)。 - -## 事件 - -不支持通用事件,仅支持以下事件: - -| 名称 | 功能描述 | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| onClick((result: [SecSaveButtonOnClickResult](#secsavebuttononclickresult枚举说明), event?: [ClickEvent](ts-universal-events-click.md#clickevent对象说明)) => void) | 点击动作触发该回调。
result:存储权限的授权结果,授权方式为5秒单次,即触发点击后,可以在5秒中之内调用媒体库接口一次,超出5秒或者调用次数超出一次都会鉴权失败。
event:见ClickEvent对象说明。 | - -## 示例 - -```ts -// xxx.ets -@Entry -@Component -struct Index { - build() { - Row() { - Column({space:10}) { - // 默认参数下,图标、文字、背景都存在 - SecSaveButton() - // 传入参数即表示元素存在,不传入的参数表示元素不存在,例如:只显示图标 - SecSaveButton({icon:SaveIconStyle.FULL_FILLED}) - // 只显示图标+背景 - SecSaveButton({icon:SaveIconStyle.FULL_FILLED, buttonType:ButtonType.Capsule}) - // 图标、文字、背景都存在 - SecSaveButton({icon:SaveIconStyle.FULL_FILLED, text:SaveDescription.DOWNLOAD, buttonType:ButtonType.Capsule}) - }.width('100%') - }.height('100%') - } -} -``` - -![secsavebutton1](figures/secsavebutton1.png) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md index aff8e864a92a6545b6a74493aaa673cdf8c5e943..3b05b7b0fe2eb98bf7d71fc0b1ad0e282a61c953 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md @@ -300,12 +300,3 @@ - [MenuItemGroup](ts-basic-components-menuitemgroup.md) 用来展示菜单MenuItem的分组。 -- [SecLocationButton](ts-basic-components-seclocationbutton.md) - - 安全控件的位置按钮,用户通过点击该位置按钮,可以临时获取精准定位权限,而不需要权限弹框授权确认。 -- [SecPasteButton](ts-basic-components-secpastebutton.md) - - 安全控件的粘贴按钮,用户通过点击该粘贴按钮,可以临时获取读取剪贴板权限,而不会触发toast提示。 -- [SecSaveButton](ts-basic-components-secsavebutton.md) - - 安全控件的保存按钮,用户通过点击该保存按钮,可以临时获取存储权限,而不需要权限弹框授权确认。 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-securitycomponent.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-securitycomponent.md deleted file mode 100644 index 4165e928cb4bc51575bf352e8debc4d02fac7950..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-securitycomponent.md +++ /dev/null @@ -1,79 +0,0 @@ -# 安全组件通用 - -安全组件的基础属性,用于设置安全组件通用的属性。 - -> **说明:** -> -> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - -## 属性 - -| 名称 | 参数类型 | 必填 | 描述 | -| --------------- | ---------------------------------------- | ---- | ---------------------------------------- | -| iconSize | [Length](ts-types.md#length) | 否 | 设置安全组件上图标的尺寸。
默认值:16vp | -| layoutDirection | [SecurityComponentLayoutDirection](#securitycomponentlayoutdirection枚举说明) | 否 | 设置安全组件上图标和文字分布的方向。
默认值:SecurityComponentLayoutDirection.HORIZONTAL | -| layoutOrder | [SecurityComponentLayoutOrder](#securitycomponentlayoutorder枚举说明) | 否 | 设置安全组件上图标和文字分布的顺序。
默认值:SecurityComponentLayoutOrder.ICON_FIRST | -| position | [Position](ts-types.md#position8) | 否 | 设置绝对定位,设置安全组件的左上角相对于父容器左上角的偏移位置。
默认值:
{
x: 0,
y: 0
} | -| markAnchor | [Position](ts-types.md#position8) | 否 | 设置绝对定位的锚点,以安全组件的左上角作为基准点进行偏移。
默认值:
{
x: 0,
y: 0
} | -| offset | [Position](ts-types.md#position8) | 否 | 设置相对定位,安全组件相对于自身的偏移量。
默认值:
{
x: 0,
y: 0
} | -| fontSize | [Length](ts-types.md#length) | 否 | 设置安全组件上文字的尺寸。
默认值:16fp | -| fontStyle | [FontStyle](ts-appendix-enums.md#fontstyle) | 否 | 设置安全组件上文字的样式。
默认值:FontStyle.Normal | -| fontWeight | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string | 否 | 设置安全组件上文字粗细。
默认值:FontWeight.Medium | -| fontFamily | string \| [Resource](ts-types.md#resource类型) | 否 | 设置安全组件上文字的字体。
默认字体:'HarmonyOS Sans' | -| fontColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置安全组件上文字的颜色。
默认值:#ffffffff | -| iconColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置安全组件上图标的颜色。
默认值:#ffffffff | -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置安全组件的背景颜色。
默认值:#007dff | -| borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) | 否 | 设置安全组件的边框的样式。
默认不设置边框样式 | -| borderWidth | [Length](ts-types.md#length) | 否 | 设置安全组件的边框的宽度。
默认不设置边框宽度 | -| borderColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置安全组件的边框的颜色。
默认不设置边框颜色 | -| borderRadius | [Length](ts-types.md#length) | 否 | 设置安全组件的边框圆角半径。
默认值:1/2 按钮整高 | -| padding | [Padding](ts-types.md#padding) \| [Length](ts-types.md#length) | 否 | 设置安全组件的内边距。
默认值:上下8vp, 左右24vp | -| textIconSpace | [Length](ts-types.md#length) | 否 | 设置安全组件中图标和文字的间距。
默认值:4vp | - -## SecurityComponentLayoutDirection枚举说明 - -| 名称 | 描述 | -| ---------- | --------------------- | -| HORIZONTAL | 安全组件上图标和文字分布的方向为水平排列。 | -| VERTICAL | 安全组件上图标和文字分布的方向为垂直排列。 | - -## SecurityComponentLayoutOrder枚举说明 - -| 名称 | 描述 | -| ---------- | ------------ | -| ICON_FIRST | 图标的排列顺序先于文字。 | -| TEXT_FIRST | 文字的排列顺序先于图标。 | - -## 示例 - -```ts -// xxx.ets -@Entry -@Component -struct Index { - build() { - Row() { - Column() { - // 生成一个保存按钮,并设置它的SecurityComponent属性 - SecSaveButton() - .fontSize(35) - .fontColor(Color.White) - .iconSize(30) - .layoutDirection(SecurityComponentLayoutDirection.HORIZONTAL) - .layoutOrder(SecurityComponentLayoutOrder.TEXT_FIRST) - .borderWidth(1) - .borderStyle(BorderStyle.Dashed) - .borderColor(Color.Blue) - .borderRadius(20) - .fontWeight(100) - .iconColor(Color.White) - .padding({left:50, top:50, bottom:50, right:50}) - .textIconSpace(20) - .backgroundColor(0x3282f6) - }.width('100%') - }.height('100%') - } -} -``` - -![securitycomponent1](figures/securitycomponent1.png)