智能客服
你问我答,随时在线为你解决问题
本模块提供Button组件的逻辑管理,辅助HarmonyOS应用和元服务通过Button组件完成相应功能。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
- import { functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
该枚举定义了FunctionalButton组件的功能类型,通过设置该参数来指定FunctionalButton的功能。
模型约束:此接口仅可在Stage模型下使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 值 | 说明 |
|---|---|---|
GET_PHONE_NUMBER | 0 | 快速验证手机号。 元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。 |
GET_REALTIME_PHONENUMBER | 1 | 实时验证手机号。 元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。 说明 GET_REALTIME_PHONENUMBER暂不对外开放使用。 |
LAUNCH_APP | 2 | 打开APP。 元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。 |
OPEN_SETTING | 3 | 打开授权设置页。 元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。 |
CHOOSE_AVATAR | 4 | 选择头像。 元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。 |
CHOOSE_ADDRESS | 5 | 选择地址。 起始版本:5.0.0(12) 元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。 |
CHOOSE_INVOICE_TITLE | 6 | 选择发票抬头。 起始版本:5.0.0(12) 元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。 |
REAL_NAME_AUTHENTICATION | 7 | 实名信息校验。 起始版本:5.0.0(12) 元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。 说明 REAL_NAME_AUTHENTICATION暂不对外开放使用。 |
FACE_AUTHENTICATION | 8 | 人脸核身。 起始版本:5.0.0(12) 元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。 说明 FACE_AUTHENTICATION暂不对外开放使用。 |
CHOOSE_LOCATION | 9 | 地图选点。 起始版本:5.0.0(12) 元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。 |
SUBSCRIBE_LIVE_VIEW | 10 | 实况窗订阅。 起始版本:5.0.0(12) |
该枚举定义了FunctionalButton的尺寸类型。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 值 | 说明 |
|---|---|---|
DEFAULT | 0 | 默认大小。 |
MINI | 1 | 小尺寸。 |
该枚举定义了FunctionalButton点击态的类型。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 值 | 说明 |
|---|---|---|
NONE | 0 | 无效果。 |
HOVER_CLASS | 1 | 默认样式。 |
该枚举定义了FunctionalButton的颜色类型。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 值 | 说明 |
|---|---|---|
DEFAULT | 0 | 蓝色。 |
PRIMARY | 1 | 绿色。 |
WARN | 2 | 红色。 |
该枚举定义了FunctionalButton的认证类型。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 值 | 说明 |
|---|---|---|
IDCard | 0 | 身份证件类型。 |
该接口定义了FunctionalButton组件的实名信息校验(预留能力,暂未支持)。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
openID | string | 否 | 否 | OpenID是华为账号用户在不同类型的产品的身份ID,同一个用户,不同应用,OpenID值不同。 |
realName | string | 否 | 否 | 证件姓名。 |
credentialID | Uint8Array | 否 | 否 | 证件号码。 |
credentialType | 否 | 是 | 证件类型。 |
该接口定义了FunctionalButton组件的样式信息。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
size | 否 | 是 | 按钮尺寸类型。默认值:functionalButtonComponentManager.SizeType.DEFAULT,字体大小为:16fp。 | |
bgColor | 否 | 是 | 按钮颜色类型。默认值:functionalButtonComponentManager.ColorType.DEFAULT,默认蓝底白字按钮样式。 | |
plain | boolean | 否 | 是 | 按钮是否镂空。“true”表示镂空。默认值:false,不镂空。 |
disabled | boolean | 否 | 是 | 按钮是否禁用。“true”表示按钮禁用。默认值:false,不禁用Button。 |
loading | boolean | 否 | 是 | 名称前是否带loading图标。“true”表示名称前带loading图标。 默认值:false,关闭loading动画。 |
hoverClass | 否 | 是 | 按钮按下去的样式。默认值:functionalButtonComponentManager.HoverClassType.HOVER_CLASS,开启点击效果。 | |
hoverStartTime | number | 否 | 是 | 按住后多久出现点击态,单位毫秒。 默认值:0 取值范围: [0, +∞) 说明 设置为小于0的值时,按值为0处理。 |
hoverStayTime | number | 否 | 是 | 手指松开后点击态保留时间,单位毫秒。 默认值:0 取值范围: [0, +∞) 说明 设置为小于0的值时,按值为0处理。 |
styleConfig | 否 | 是 | 按钮样式配置。 说明 当styleConfig和StyleOption中定义的样式冲突时,最终以styleConfig的为准。 |
该接口定义了FunctionalButton组件的参数,定义Button功能以及样式等。
模型约束:此接口仅可在Stage模型下使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
openType | 否 | 否 | 按钮功能场景类型。默认值:functionalButtonComponentManager.OpenType.GET_PHONE_NUMBER。 元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。 | |
label | 否 | 否 | 按钮展示文字。默认值:空字符串。 元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。 | |
styleOption | 否 | 是 | 按钮样式。 元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。 说明 在Button外设置的样式属性不生效,仅生效styleOption中设置的样式。 | |
appParam | 否 | 是 | 需打开APP的信息。例如:{bundleName: "xxx", abilityName: "xxx"}。 bundleName:包名。 abilityName:Ability名称。 元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。 说明 openType为“functionalButtonComponentManager.OpenType.LAUNCH_APP”时必填。 | |
realNameAuthenticationInfo | 否 | 是 | 实名信息校验按钮信息(预留能力,暂未支持)。 起始版本:5.0.0(12) 元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。 | |
subscribeLiveViewParam | 否 | 是 | 实况窗订阅按钮信息。 起始版本:5.0.0(12) |
该接口定义了使用快速验证功能成功验证的响应。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
code | string | 否 | 是 | 账号用户的临时登录凭证(Authorization Code)。 说明 可通过临时登录凭证获取真实手机号,临时登录凭证时效5分钟,具体操作可参考“服务端开发”章节。 |
该接口定义了使用实时验证功能成功验证的响应。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
code | string | 否 | 是 | 账号用户的临时登录凭证(Authorization Code)。 说明 可通过临时登录凭证获取真实手机号,临时登录凭证时效5分钟,具体操作可参考“服务端开发”章节。 |
该接口定义了使用打开授权设置页功能,成功跳转授权设置页后返回应用或结束设置应用,应用权限设置情况的响应。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
permissions | Map<string, boolean> | 否 | 是 | 权限字典表。 key为权限名称,value为权限是否开启,true表示开启权限,false表示关闭权限。 |
该接口定义了使用选择头像功能成功选择的响应。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
avatarUri | string | 否 | 是 | 所选头像图片的地址。 说明 返回的地址为裁剪之后的图片对应的地址。 |
该接口定义了FunctionalButton为打开APP功能时,通过该参数指定打开的应用对应的包名和Ability名称。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
bundleName | 否 | 否 | 包名。 | |
abilityName | 否 | 是 | Ability名称。默认值:EntryAbility。 |
该接口定义了FunctionalButton为选择收货地址功能时,通过该参数指定选择收货地址对应的返回体。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
userName | string | 否 | 否 | 用户名称。 |
mobileNumber | string | 否 | 是 | 手机号码。 |
telNumber | string | 否 | 是 | 固定电话号码。 |
zipCode | string | 否 | 是 | 邮政编码。 |
countryCode | string | 否 | 是 | 国家/地区代码。 |
provinceName | string | 否 | 是 | 省份名称。 |
cityName | string | 否 | 是 | 城市名称。 |
districtName | string | 否 | 是 | 地区名称。 |
streetName | string | 否 | 是 | 街道名称。 |
detailedAddress | string | 否 | 否 | 详细地址。 |
该接口定义了FunctionalButton为选择发票抬头功能时,通过该参数指定选择发票抬头对应的返回体。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
type | string | 否 | 否 | 发票类型,0-个人 1-企业。 |
title | string | 否 | 否 | 发票抬头。 |
taxNumber | string | 否 | 否 | 税号。 |
companyAddress | string | 否 | 是 | 公司地址。 |
telephone | string | 否 | 是 | 电话号码。 |
bankName | string | 否 | 是 | 银行名称。 |
bankAccount | string | 否 | 是 | 银行账户。 |
该接口定义了FunctionalButton为实名信息校验功能时,通过该参数指定实名信息校验对应的返回体。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
authCode | string | 否 | 是 | 临时凭据,有效时间5分钟,并且只能使用一次。 |
openID | string | 否 | 是 | OpenID是华为账号用户在不同类型的产品的身份ID,同一个用户,不同应用,OpenID值不同。 |
该接口定义了FunctionalButton为人脸核身功能时,通过该参数指定人脸认证对应的返回体。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
authCode | string | 否 | 是 | 临时凭据,有效时间5分钟,并且只能使用一次。 |
openID | string | 否 | 是 | OpenID是华为账号用户在不同类型的产品的身份ID,同一个用户,不同应用,OpenID值不同。 |
该接口定义了FunctionalButton为人脸核身功能时,通过该参数指定人脸核身对应的返回体。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
facialRecognitionVerificationToken | string | 否 | 是 | 验证成功后返回的token。 |
state | string | 否 | 是 | 响应体中返回的state,字符包含0-9、a-z、A-Z、英文点号、英文冒号、斜杆、下划线等,长度限制255,校验规则^[0-9a-zA-Z:/\.\-_]{1,255}$。与请求体中传入的state比较,校验是否是当前请求,防止跨站攻击。 |
该接口定义了FunctionalButton为地图选点功能时,通过该参数指定地图选点对应的返回体。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
name | string | 否 | 否 | 位置名称。 |
longitude | number | 否 | 否 | 经度。 |
latitude | number | 否 | 否 | 纬度。 |
address | string | 否 | 否 | 地址。 |
该接口定义了FunctionalButton组件为实况窗订阅功能时,通过该参数指定实况窗订阅对应的订阅事件和计时器。
模型约束:此接口仅可在Stage模型下使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
event | string | 否 | 否 | 订阅事件。 固定值:SUBSCRIBE_TIMER。 |
alertTime | number | 否 | 否 | 计时器提醒时间,毫秒级时间戳。 说明
|
startTime | number | 否 | 否 | 计时器开始时间,毫秒级时间戳。 说明
|
该接口定义了FunctionalButton组件为实况窗订阅功能时,通过该参数指定实况窗订阅对应的返回体。
模型约束:此接口仅可在Stage模型下使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
名称 | 类型 | 只读 | 可选 | 说明 |
|---|---|---|---|---|
subscribeId | string | 否 | 否 | 订阅事件ID。 |
不支持通用事件,仅支持以下事件:
FunctionalButton组件控制器,用来回调组件内部的点击事件。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
onGetPhoneNumber(callback: AsyncCallback<GetPhoneNumberResult>): FunctionalButtonController
注册FunctionalButton组件为快速验证手机号的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<GetPhoneNumberResult> | 是 | 回调函数。callback返回账号用户的临时登录凭证(Authorization Code)。 说明 可通过临时登录凭证获取真实手机号,临时登录凭证时效5分钟,具体操作可参考“服务端开发”章节。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
-
- @Entry
- @Component
- struct Index {
- build() {
- Row() {
- Column() {
- // 声明FunctionalButton
- FunctionalButton({
- params: {
- // OpenType.GET_PHONE_NUMBER表示Button为快速验证手机号类型
- openType: functionalButtonComponentManager.OpenType.GET_PHONE_NUMBER,
- label: '快速验证手机号',
- // 调整Button样式
- styleOption: {
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- },
- // OpenType为“GET_PHONE_NUMBER”时,回调必须选择“onGetPhoneNumber”
- controller: new functionalButtonComponentManager.FunctionalButtonController()
- .onGetPhoneNumber((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理
- hilog.info(0x0000, "testTag", "succeeded in authenticating");
- // 获取Authorization Code
- let authorizationCode = data.code;
- })
- })
- }.width('100%')
- }.height('100%')
- }
- }
onGetRealtimePhoneNumber(callback: AsyncCallback<GetRealtimePhoneNumberResult>): FunctionalButtonController
注册FunctionalButton组件为实时验证手机号的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<GetRealtimePhoneNumberResult> | 是 | 回调函数。callback返回账号用户的临时登录凭证(Authorization Code)。 说明 可通过临时登录凭证获取真实手机号,临时登录凭证时效5分钟,具体操作可参考“服务端开发”章节。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import {FunctionalButton, functionalButtonComponentManager} from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
-
- @Entry
- @Component
- struct Index {
- build() {
- Row() {
- Column() {
- // 声明FunctionalButton
- FunctionalButton({
- params: {
- // OpenType.GET_REALTIME_PHONENUMBER表示Button为实时验证手机号类型
- openType: functionalButtonComponentManager.OpenType.GET_REALTIME_PHONENUMBER,
- label: '实时验证手机号',
- // 调整Button样式
- styleOption: {
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- },
- // OpenType为“GET_REALTIME_PHONENUMBER”时,回调必须选择“onGetRealtimePhoneNumber”
- controller: new functionalButtonComponentManager.FunctionalButtonController()
- .onGetRealtimePhoneNumber((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理
- hilog.info(0x0000, "testTag", "succeeded in authenticating");
- // 获取Authorization Code
- let authorizationCode = data.code;
- })
- })
- }
- .width('100%')
- }
- .height('100%')
- }
- }
onLaunchApp(callback: AsyncCallback<void>): FunctionalButtonController
注册FunctionalButton组件为打开APP的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<void> | 是 | 回调函数。当打开APP完成,err为undefined,否则返回错误对象。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
-
- @Entry
- @Component
- struct Index {
- build() {
- Row() {
- Column() {
- // 声明FunctionalButton
- FunctionalButton({
- params: {
- // OpenType.LAUNCH_APP表示Button为打开APP类型
- openType: functionalButtonComponentManager.OpenType.LAUNCH_APP,
- label: '打开APP',
- // OpenType为“functionalButtonComponentManager.OpenType.LAUNCH_APP”时,appParam参数必填
- appParam: {
- bundleName: "xxx",
- abilityName: "xxx"
- },
- // 调整Button样式
- styleOption: {
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- },
- // OpenType为“LAUNCH_APP”时,回调必须选择“onLaunchApp”
- controller: new functionalButtonComponentManager.FunctionalButtonController().onLaunchApp((err) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理,成功时无返回值
- hilog.info(0x0000, "testTag", "succeeded in launching app");
- })
- })
- }.width('100%')
- }.height('100%')
- }
- }
“bundleName”为包名,“abilityName”为Ability名称。
onOpenSetting(callback: AsyncCallback<OpenSettingResult>): FunctionalButtonController
注册FunctionalButton组件为打开授权设置页的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<OpenSettingResult> | 是 | 回调函数。callback会返回跳转失败时的错误码,当成功跳转授权设置页后,返回应用或结束设置应用返回权限设置情况。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
-
- @Entry
- @Component
- struct Index {
- build() {
- Row() {
- Column() {
- // 声明FunctionalButton
- FunctionalButton({
- params: {
- // OpenType.OPEN_SETTING表示Button为打开授权设置页类型
- openType: functionalButtonComponentManager.OpenType.OPEN_SETTING,
- label: '打开授权设置页',
- // 调整Button样式
- styleOption: {
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- },
- // OpenType为“OPEN_SETTING”时,回调必须选择“onOpenSetting”
- controller: new functionalButtonComponentManager.FunctionalButtonController().onOpenSetting((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理,终止设置应用程序时触发
- hilog.info(0x0000, "testTag", "succeeded in opening setting");
- data.permissions!.forEach((value, key) => {
- hilog.info(0x0000, "testTag", "key: %{public}s value: %{public}s", String(key), value);
- })
- })
- })
- }.width('100%')
- }.height('100%')
- }
- }
onChooseAvatar(callback: AsyncCallback<ChooseAvatarResult>): FunctionalButtonController
注册FunctionalButton组件为选择头像的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<ChooseAvatarResult> | 是 | 回调函数。callback返回所选头像图片的地址。 说明 返回的地址为裁剪之后的图片对应的地址。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
-
- @Entry
- @Component
- struct Index {
- // 对应路径 /resources/base/media/下新增 account.png,否则会报错找不到
- @State url: ResourceStr = $r('app.media.account');
-
- build() {
- Column() {
- // 声明FunctionalButton
- FunctionalButton({
- params: {
- // OpenType.CHOOSE_AVATAR表示Button为选择头像类型
- openType: functionalButtonComponentManager.OpenType.CHOOSE_AVATAR,
- label: '',
- // 调整Button样式
- styleOption: {
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .type(ButtonType.Normal)
- .backgroundImage(this.url)
- .backgroundImageSize(ImageSize.Cover)
- .width(80)
- .height(80)
- .backgroundColor('#E5E5E5')
- },
- },
- // OpenType为“CHOOSE_AVATAR”时,回调必须选择“onChooseAvatar”
- controller: new functionalButtonComponentManager.FunctionalButtonController().onChooseAvatar((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理
- hilog.info(0x0000, "testTag", "succeeded in choosing avatar");
- this.url = data.avatarUri!;
- })
- })
- }
- .padding({ top: 200 })
- .height('100%')
- .width('100%')
- }
- }
onChooseAddress(callback: AsyncCallback<ChooseAddressResult>): FunctionalButtonController
注册FunctionalButton组件为选择收货地址的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<ChooseAddressResult> | 是 | 回调函数。callback返回选择收货地址的地址。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
-
- @Entry
- @Component
- struct Index {
- build() {
- Row() {
- Column() {
- // 声明FunctionalButton
- FunctionalButton({
- params: {
- // OpenType.CHOOSE_ADDRESS表示Button为选择收货地址
- openType: functionalButtonComponentManager.OpenType.CHOOSE_ADDRESS,
- label: '选择收货地址',
- // 调整Button样式
- styleOption: {
- bgColor:functionalButtonComponentManager.ColorType.DEFAULT,
- size: functionalButtonComponentManager.SizeType.DEFAULT,
- plain: false,
- disabled:false,
- loading: false,
- hoverClass: functionalButtonComponentManager.HoverClassType.HOVER_CLASS,
- hoverStartTime: 0,
- hoverStayTime: 0,
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- },
- // OpenType为“CHOOSE_ADDRESS”时,回调必须选择“onChooseAddress”
- controller: new functionalButtonComponentManager.FunctionalButtonController()
- .onChooseAddress((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理
- hilog.info(0x0000, "testTag", "succeeded in choosing address");
- // 获取Address info
- let userName: string = data.userName;
- let mobileNumber: string = data.mobileNumber as string;
- let countryCode: string = data.countryCode as string;
- let provinceName: string = data.provinceName as string;
- let cityName: string = data.cityName as string;
- let districtName: string = data.districtName as string;
- let streetName: string = data.streetName as string;
- let detailedAddress: string = data.detailedAddress;
- })
- })
- }.width('100%')
- }.height('100%')
- }
- }
onChooseInvoiceTitle(callback: AsyncCallback<ChooseInvoiceTitleResult>): FunctionalButtonController
注册FunctionalButton组件为选择发票抬头的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<ChooseInvoiceTitleResult> | 是 | 回调函数。callback返回选择发票抬头的结果。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
-
- @Entry
- @Component
- struct Index {
- build() {
- Row() {
- Column() {
- // 声明FunctionalButton
- FunctionalButton({
- params: {
- // OpenType.CHOOSE_INVOICE_TITLE表示Button为选择发票抬头
- openType: functionalButtonComponentManager.OpenType.CHOOSE_INVOICE_TITLE,
- label: '选择发票抬头',
- // 调整Button样式
- styleOption: {
- bgColor:functionalButtonComponentManager.ColorType.DEFAULT,
- size: functionalButtonComponentManager.SizeType.DEFAULT,
- plain: false,
- disabled:false,
- loading: false,
- hoverClass: functionalButtonComponentManager.HoverClassType.HOVER_CLASS,
- hoverStartTime: 0,
- hoverStayTime: 0,
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- },
- // OpenType为“CHOOSE_INVOICE_TITLE”时,回调必须选择“onChooseInvoiceTitle”
- controller: new functionalButtonComponentManager.FunctionalButtonController()
- .onChooseInvoiceTitle((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理
- hilog.info(0x0000, "testTag", "succeeded in obtaining invoice title");
- // 获取发票信息
- let type: string = data.type;
- let title: string = data.title;
- let taxNumber: string = data.taxNumber;
- let companyAddress: string | undefined = data.companyAddress;
- let telephone: string | undefined = data.telephone;
- let bankName: string | undefined = data.bankName;
- let bankAccount: string | undefined = data.bankAccount;
- })
- })
- }.width('100%')
- }.height('100%')
- }
- }
onRealNameAuthentication(callback: AsyncCallback<RealNameAuthenticationResult>): FunctionalButtonController
注册FunctionalButton组件为实名信息校验的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<RealNameAuthenticationResult> | 是 | 回调函数。callback返回实名信息校验鉴权对应的返回体:authCode、openID。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
- import { http } from '@kit.NetworkKit';
- import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
-
- interface Result {
- state?: number;
- realNameLevel?: number;
- verifyResult?: number;
- verifyToken?: string;
- }
-
- @Entry
- @Component
- struct SecondPage {
-
- obtainRealNameDataInfo(authCode: string, sceneID:number, openID: string, realName: string, idNo: string,
- callback: AsyncCallback<Result>) {
- // 每一个httpRequest对应一个HTTP请求任务,不可复用
- let httpRequest = http.createHttp();
- // 用于订阅HTTP响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息
- httpRequest.on('headersReceive', (header) => {
- hilog.info(0x0000, "testTag", "header: %{public}s", header as string);
- });
- httpRequest.request(
- // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
- "EXAMPLE_URL",
- {
- method: http.RequestMethod.POST,
- // 开发者根据自身业务需要添加header字段
- header: {
- 'Content-Type': 'application/json'
- },
- // 当使用POST请求时此字段用于传递内容
- extraData: {
- "authCode": authCode,
- "sceneID": sceneID,
- "openID": openID,
- "realname": realName,
- "idNo": idNo,
- },
- expectDataType: http.HttpDataType.STRING,
- usingCache: true,
- priority: 1,
- connectTimeout: 60000,
- readTimeout: 60000,
- usingProtocol: http.HttpProtocol.HTTP1_1,
- }, (err, data) => {
- if (!err) {
- let res: Result = JSON.parse(data.result as string);
- callback(undefined, res);
- } else {
- let error: BusinessError = {code: err.code, message: err.message, name: ''};
- callback(error, undefined);
- // 取消订阅HTTP响应头事件
- httpRequest.off('headersReceive');
- // 当该请求使用完毕时,调用destroy方法主动销毁
- httpRequest.destroy();
- }
- })
- }
-
- build() {
- Row() {
- Column() {
- FunctionalButton({
- params: {
- // OpenType.REAL_NAME_AUTHENTICATION表示Button为实名信息校验
- openType: functionalButtonComponentManager.OpenType.REAL_NAME_AUTHENTICATION,
- label: '实名信息校验',
- // 调整Button样式
- styleOption: {
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- },
- // OpenType为“REAL_NAME_AUTHENTICATION”时,回调必须选择“onRealNameAuthentication”
- controller: new functionalButtonComponentManager.FunctionalButtonController()
- .onRealNameAuthentication((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理
- hilog.info(0x0000, "testTag", "succeeded in authenticating");
- // 获取Authorization Code
- let authCode: string = data.authCode as string;
- let openID: string = data.openID as string;
- // sceneid调用场景 0:开放实名信息校验场景;1:人脸核身,验证姓名/证件类型/证件号/人脸场景;2:人脸核身,验证人脸场景
- this.obtainRealNameDataInfo(authCode, 0, openID, 'name', 'idNo', (err, data) => {
- if (err) {
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- let state = data.state;
- let realNameLevel = data.realNameLevel;
- let verifyResult = data.verifyResult;
- let verifyToken = data.verifyToken;
- hilog.info(0x0000, "testTag", "succeeded in verifying");
- })
- })
- })
- }
- .width('100%')
- }
- .height('100%')
- }
- }
onFaceAuthentication(callback: AsyncCallback<FaceAuthenticationResult>): FunctionalButtonController
注册FunctionalButton组件为人脸核身的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<FaceAuthenticationResult> | 是 | 回调函数。callback返回人脸核身鉴权对应的返回体:authCode、openID。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
- import { http } from '@kit.NetworkKit';
- import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
-
- interface Result {
- state?: number;
- realNameLevel?: number;
- verifyResult?: number;
- verifyToken?: string;
- }
-
- @Entry
- @Component
- struct SecondPage {
- obtainFaceVerifyDataInfo(authCode: string, sceneID: number, openID: string, realName: string, idNo: string,
- callback: AsyncCallback<Result>) {
- // 每一个httpRequest对应一个HTTP请求任务,不可复用
- let httpRequest = http.createHttp();
- // 用于订阅HTTP响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息
- httpRequest.on('headersReceive', (header) => {
- hilog.info(0x0000, "testTag", "header: %{public}s", header as string);
- });
- httpRequest.request(
- // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
- "EXAMPLE_URL",
- {
- method: http.RequestMethod.POST,
- // 开发者根据自身业务需要添加header字段
- header: {
- 'Content-Type': 'application/json'
- },
- // 当使用POST请求时此字段用于传递内容
- extraData: {
- "authCode": authCode,
- "sceneID": sceneID,
- "openID": openID,
- "realname": realName,
- "idNo": idNo,
- },
- expectDataType: http.HttpDataType.STRING,
- usingCache: true,
- priority: 1,
- connectTimeout: 60000,
- readTimeout: 60000,
- usingProtocol: http.HttpProtocol.HTTP1_1,
- }, (err, data) => {
- if (!err) {
- let res: Result = JSON.parse(data.result as string);
- callback(undefined, res);
- } else {
- let error: BusinessError = { code: err.code, message: err.message, name: '' };
- callback(error, undefined);
- // 取消订阅HTTP响应头事件
- httpRequest.off('headersReceive');
- // 当该请求使用完毕时,调用destroy方法主动销毁
- httpRequest.destroy();
- }
- })
- }
-
- build() {
- Row() {
- Column() {
- FunctionalButton({
- params: {
- // OpenType.FACE_AUTHENTICATION表示Button为人脸核身类型
- openType: functionalButtonComponentManager.OpenType.FACE_AUTHENTICATION,
- label: '人脸核身',
- // 调整Button样式
- styleOption: {
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- },
- // OpenType为“FACE_AUTHENTICATION”时,回调必须选择“onFaceAuthentication”
- controller: new functionalButtonComponentManager.FunctionalButtonController()
- .onFaceAuthentication((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理
- hilog.info(0x0000, "testTag", "succeeded in authenticating");
- // 获取Authorization Code
- let authCode: string = data.authCode as string;
- let openID: string = data.openID as string;
- hilog.info(0x0000, "testTag", "succeeded in authCode");
- // sceneid调用场景 0:开放实名信息校验场景;1:人脸核身,验证姓名/证件类型/证件号/人脸场景;2:人脸核身,验证人脸场景
- this.obtainFaceVerifyDataInfo(authCode, 2, openID, "", "", (err, data) => {
- if (err) {
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- let verifyToken: string = data.verifyToken as string;
- new functionalButtonComponentManager.FunctionalButtonController().onFaceVerification(verifyToken,
- (error, data) => {
- if (error) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", error.code, error.message);
- return;
- }
- let facialRecognitionVerificationToken = data.facialRecognitionVerificationToken;
- let state = data.state;
- hilog.info(0x0000, 'testTag', 'auth result success');
- });
- })
- })
- })
- }
- .width('100%')
- }
- .height('100%')
- }
- }
onFaceVerification(verifyToken: string, callback: AsyncCallback<FaceVerificationResult>): void
注册FunctionalButton组件为人脸验证的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
verifyToken | string | 是 | 验证成功的idToken,三方应用拉起华为账号客户端人脸验证页面时传入此Token,供华为账号客户端校验验证结果。 |
callback | AsyncCallback<FaceVerificationResult> | 是 | 回调函数。callback返回人脸验证的结果。 |
示例:
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
- import { http } from '@kit.NetworkKit';
- import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
-
- interface Result {
- state?: number;
- realNameLevel?: number;
- verifyResult?: number;
- verifyToken?: string;
- }
-
- @Entry
- @Component
- struct SecondPage {
- obtainFaceVerifyDataInfo(authCode: string, sceneID: number, openID: string, realName: string, idNo: string,
- callback: AsyncCallback<Result>) {
- // 每一个httpRequest对应一个HTTP请求任务,不可复用
- let httpRequest = http.createHttp();
- // 用于订阅HTTP响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息
- httpRequest.on('headersReceive', (header) => {
- hilog.info(0x0000, "testTag", "header: %{public}s", header as string);
- });
- httpRequest.request(
- // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
- "EXAMPLE_URL",
- {
- method: http.RequestMethod.POST,
- // 开发者根据自身业务需要添加header字段
- header: {
- 'Content-Type': 'application/json'
- },
- // 当使用POST请求时此字段用于传递内容
- extraData: {
- "authCode": authCode,
- "sceneID": sceneID,
- "openID": openID,
- "realname": realName,
- "idNo": idNo,
- },
- expectDataType: http.HttpDataType.STRING,
- usingCache: true,
- priority: 1,
- connectTimeout: 60000,
- readTimeout: 60000,
- usingProtocol: http.HttpProtocol.HTTP1_1,
- }, (err, data) => {
- if (!err) {
- let res: Result = JSON.parse(data.result as string);
- callback(undefined, res);
- } else {
- let error: BusinessError = { code: err.code, message: err.message, name: '' };
- callback(error, undefined);
- // 取消订阅HTTP响应头事件
- httpRequest.off('headersReceive');
- // 当该请求使用完毕时,调用destroy方法主动销毁
- httpRequest.destroy();
- }
- })
- }
-
- build() {
- Row() {
- Column() {
- FunctionalButton({
- params: {
- // OpenType.FACE_AUTHENTICATION表示Button为人脸核身类型
- openType: functionalButtonComponentManager.OpenType.FACE_AUTHENTICATION,
- label: '人脸核身',
- // 调整Button样式
- styleOption: {
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- },
- // OpenType为“FACE_AUTHENTICATION”时,回调必须选择“onFaceAuthentication”
- controller: new functionalButtonComponentManager.FunctionalButtonController()
- .onFaceAuthentication((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理
- hilog.info(0x0000, "testTag", "succeeded in authenticating");
- // 获取Authorization Code
- let authCode: string = data.authCode as string;
- let openID: string = data.openID as string;
- hilog.info(0x0000, "testTag", "succeeded in authCode");
- // sceneid调用场景 0:开放实名信息校验场景;1:人脸核身,验证姓名/证件类型/证件号/人脸场景;2:人脸核身,验证人脸场景
- this.obtainFaceVerifyDataInfo(authCode, 2, openID, "", "", (err, data) => {
- if (err) {
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- let verifyToken: string = data.verifyToken as string;
- new functionalButtonComponentManager.FunctionalButtonController().onFaceVerification(verifyToken,
- (error, data) => {
- if (error) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", error.code, error.message);
- return;
- }
- let facialRecognitionVerificationToken = data.facialRecognitionVerificationToken;
- let state = data.state;
- hilog.info(0x0000, 'testTag', 'auth result success');
- });
- })
- })
- })
- }
- .width('100%')
- }
- .height('100%')
- }
- }
onChooseLocation(callback: AsyncCallback<ChooseLocationResult>): FunctionalButtonController
注册FunctionalButton组件为打开地图选点的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本5.0.0(12)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<ChooseLocationResult> | 是 | 回调函数。callback返回打开地图选点的结果。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
-
- @Entry
- @Component
- struct Index {
- build() {
- Row() {
- Column() {
- // 声明FunctionalButton
- FunctionalButton({
- params: {
- // OpenType.CHOOSE_LOCATION表示Button为地图选点
- openType: functionalButtonComponentManager.OpenType.CHOOSE_LOCATION,
- label: '地图选点',
- // 调整Button样式
- styleOption: {
- bgColor:functionalButtonComponentManager.ColorType.DEFAULT,
- size: functionalButtonComponentManager.SizeType.DEFAULT,
- plain: false,
- disabled:false,
- loading: false,
- hoverClass: functionalButtonComponentManager.HoverClassType.HOVER_CLASS,
- hoverStartTime: 0,
- hoverStayTime: 0,
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- }
- },
- // OpenType为“CHOOSE_LOCATION”时,回调必须选择“onChooseLocation”
- controller: new functionalButtonComponentManager.FunctionalButtonController()
- .onChooseLocation((err, data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", "error: %{public}d %{public}s", err.code, err.message);
- return;
- }
- // 成功日志处理
- hilog.info(0x0000, "testTag", "succeeded in choosing location");
- let name: string = data.name;
- let address: string = data.address;
- let longitude: number = data.longitude;
- let latitude: number = data.latitude;
- })
- })
- }.width('100%')
- }.height('100%')
- }
- }
onSubscribeLiveView(callback: AsyncCallback<SubscribeLiveViewResult>): FunctionalButtonController
注册FunctionalButton组件为实况窗订阅的点击事件,使用callback异步回调。
模型约束:此接口仅可在Stage模型下使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:5.0.0(12)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
callback | AsyncCallback<SubscribeLiveViewResult> | 是 | 回调函数。callback会返回实况订阅的结果。 |
返回值:
类型 | 说明 |
|---|---|
FunctionalButton组件控制器。 |
示例:
- import { hilog } from '@kit.PerformanceAnalysisKit';
- import { FunctionalButton, functionalButtonComponentManager } from '@kit.ScenarioFusionKit';
-
- @Entry
- @Component
- struct Index {
- build() {
- Row() {
- Column() {
- // 声明FunctionalButton
- FunctionalButton({
- params: {
- // OpenType.SUBSCRIBE_LIVE_VIEW表示Button为实况窗订阅类型
- openType: functionalButtonComponentManager.OpenType.SUBSCRIBE_LIVE_VIEW,
- label: '预约抢购',
- // 调整Button样式
- styleOption: {
- styleConfig: new functionalButtonComponentManager.ButtonConfig()
- .fontSize(20)
- .fontColor(Color.Black)
- },
- subscribeLiveViewParam: {
- event: "SUBSCRIBE_TIMER",
- alertTime: 172178838111,
- startTime: 172170198111
- },
- },
- // OpenType为“SUBSCRIBE_LIVE_VIEW”时,回调必须选择“onSubscribeLiveView”
- controller: new functionalButtonComponentManager.FunctionalButtonController().onSubscribeLiveView((err,
- data) => {
- if (err) {
- // 错误日志处理
- hilog.error(0x0000, "testTag", `error code is: ${err?.code} message is ${err?.message}`);
- return;
- }
- let subscribeId = data.subscribeId;
- // 成功日志处理
- hilog.info(0x0000, "testTag", "successed in subscribing LiveView");
- })
- })
- }
- .width('100%')
- }
- .height('100%')
- }
- }
该类提供了实现FunctionalButton自定义属性的方法。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
type(value: ButtonType): ButtonConfig
设置FunctionalButton的显示样式属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 描述按钮显示样式。 默认值:ButtonType.Capsule |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
stateEffect(value: boolean): ButtonConfig
设置FunctionalButton是否开启按压态显示效果属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | boolean | 是 | 按钮按下时是否开启按压态显示效果,当设置为false时,按压效果关闭;设置为true时,按压效果开启。 默认值:true |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
fontColor(value: ResourceColor): ButtonConfig
设置FunctionalButton的字体颜色属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置字体颜色。 默认值:#ffffff |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
fontSize(value: Length): ButtonConfig
设置FunctionalButton的字体大小属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
fontWeight(value: string | number | FontWeight): ButtonConfig
设置FunctionalButton的字体粗细属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | string | number | FontWeight | 是 | 设置文本的字体粗细,number类型取值[100, 900],取值间隔为100,默认为400,取值越大,字体越粗。string类型仅支持number类型取值的字符串形式,例如"400",以及"bold"、"bolder"、"lighter"、"regular"、"medium"、"normal",分别对应FontWeight中相应的枚举值。 默认值:FontWeight.Normal |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
fontStyle(value: FontStyle): ButtonConfig
设置FunctionalButton的字体样式属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置字体样式。 默认值:FontStyle.Normal |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
fontFamily(value: string | Resource): ButtonConfig
设置FunctionalButton的字体属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | string | Resource | 是 | 设置字体列表。默认字体'HarmonyOS Sans',当前支持'HarmonyOS Sans'字体和注册自定义字体。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
width(value: Length): ButtonConfig
设置FunctionalButton的宽度属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置组件自身的宽度,缺省时使用元素自身内容需要的宽度。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
height(value: Length): ButtonConfig
设置FunctionalButton的高度属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置组件自身的高度,缺省时使用元素自身内容需要的高度。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
size(value: SizeOptions): ButtonConfig
设置FunctionalButton的高宽尺寸属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置高宽尺寸。举例: 单位:vp。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
constraintSize(value: ConstraintSizeOptions): ButtonConfig
设置FunctionalButton的约束尺寸属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置约束尺寸,组件布局时,进行尺寸范围限制。constraintSize的优先级高于width和height。取值结果参考constraintSize取值对width/height影响。 默认值: 单位:vp。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
padding(value: Length | Padding): ButtonConfig
设置FunctionalButton的内边距属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
margin(value: Length | Padding): ButtonConfig
设置FunctionalButton的外边距属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
backgroundColor(value: ResourceColor): ButtonConfig
设置FunctionalButton的背景色属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置组件的背景色。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
backgroundImage(src: ResourceStr, repeat?: ImageRepeat): ButtonConfig
设置FunctionalButton的背景图像属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
src | 是 | 图片地址,支持网络图片资源和本地图片资源地址,不支持svg类型的图片。 | |
repeat | 否 | 设置背景图的重复样式,默认不重复。当设置的背景图片为透明底色图片,且同时设置了backgroundColor时,二者叠加显示,背景颜色在最底部。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
backgroundImageSize(value: SizeOptions | ImageSize): ButtonConfig
设置FunctionalButton的背景图像的高度和宽度属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置背景图像的高度和宽度。当输入为{width: Length, height: Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。 width和height取值范围: [0, +∞) 默认值:ImageSize.Auto 说明 设置为小于0的值时,按值为0显示。当设置了height未设置width时,width根据图片原始宽高比进行调整。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
backgroundImagePosition(value: Position | Alignment): ButtonConfig
设置FunctionalButton的背景图像的显示位置属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
opacity(value: number | Resource): ButtonConfig
设置FunctionalButton的透明度属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | number | Resource | 是 | 元素的不透明度,取值范围为0到1,1表示不透明,0表示完全透明, 达到隐藏组件效果,但是在布局中占位。 说明 子组件可以继承父组件的此属性。默认值:1 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
border(value: BorderOptions): ButtonConfig
统一设置FunctionalButton的边框宽度、边框颜色、边框圆角半径、边框样式属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 统一边框样式设置接口。 - width:设置边框宽度。 - color:设置边框颜色。 - radius:设置边框圆角半径。 - style:设置边框样式。 说明 边框宽度默认值为0,即不显示边框。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
borderStyle(value: BorderStyle | EdgeStyles): ButtonConfig
设置FunctionalButton的边框样式属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置元素的边框样式。 默认值:BorderStyle.Solid |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
borderWidth(value: Length | EdgeWidths): ButtonConfig
设置FunctionalButton的边框宽度属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置元素的边框宽度,不支持百分比。 默认值:1,单位:vp。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
borderColor(value: ResourceColor | EdgeColors): ButtonConfig
设置FunctionalButton的边框颜色属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置元素的边框颜色。 默认值:#000000 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
borderRadius(value: Length | BorderRadiuses): ButtonConfig
设置FunctionalButton的边框圆角半径属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置元素的边框圆角半径,不支持百分比。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
borderImage(value: BorderImageOption): ButtonConfig
设置FunctionalButton的图片边框属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 图片边框或者渐变色边框设置接口。 该接口支持在ArkTS卡片中使用。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
scale(value: ScaleOptions): ButtonConfig
设置FunctionalButton的缩放属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 可以分别设置X轴、Y轴、Z轴的缩放比例,默认值为1.0,同时可以通过centerX和centerY设置缩放的中心点。 默认值: |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
align(value: Alignment): ButtonConfig
设置FunctionalButton的对齐方式属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置元素内容的对齐方式,只有当设置的width和height大小超过元素本身内容大小时生效。 默认值:Alignment.Center |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
markAnchor(value: Position): ButtonConfig
设置FunctionalButton在位置定位时的锚点。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置元素在位置定位时的锚点,以元素顶部起点作为基准点进行偏移。 默认值: |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
offset(value: Position): ButtonConfig
设置FunctionalButton在位置坐标偏移量。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置元素在位置定位时的锚点,以元素顶部起点作为基准点进行偏移。 默认值: |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
enabled(value: boolean): ButtonConfig
设置FunctionalButton的是否禁用属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | boolean | 是 | 值为true表示组件可交互,响应点击等操作。 值为false表示组件不可交互,不响应点击等操作。 默认值:true |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
loadingColor(value: ResourceColor): ButtonConfig
设置FunctionalButton中的LoadingProgress图标的颜色属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置图标颜色。默认值:#FFFFFF 说明 设置为异常值时,按值为'#ff666666'显示。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
loadingWidth(value: Length): ButtonConfig
设置FunctionalButton中的LoadingProgress图标的宽度属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置图标自身的宽度。默认值:20,单位:vp。 取值范围:(-∞, +∞) 填写为负数时,宽度不超过按钮大小;填写正数时,宽度不受限于按钮大小,请合理填写数值。 说明 LoadingProgress图标始终保持正方形,在显示时边长会取loadingWidth和loadingHeight中的最小值。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
loadingHeight(value: Length): ButtonConfig
设置FunctionalButton中的LoadingProgress图标的高度属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
value | 是 | 设置图标自身的高度。默认值:20,单位:vp。 取值范围:(-∞, +∞) 填写为负数时,高度不超过按钮大小。填写正数时,高度不受限于按钮大小,请合理填写数值。 说明 LoadingProgress图标始终保持正方形,在显示时边长会取loadingWidth和loadingHeight中的最小值。 |
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
loadingPadding(value: Length | Padding): ButtonConfig
设置FunctionalButton中的LoadingProgress图标的内边距属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |
loadingMargin(value: Length | Padding): ButtonConfig
设置FunctionalButton中的LoadingProgress图标的外边距属性。
模型约束:此接口仅可在Stage模型下使用。
元服务API:从版本4.1.0(11)开始,该接口支持在元服务中使用。
系统能力:SystemCapability.AtomicserviceComponent.UIComponent
起始版本:4.1.0(11)
参数:
返回值:
类型 | 说明 |
|---|---|
ButtonConfig对象。 |