示例代码import common from '@ohos.app.ability.common'; import Want from '@ohos.app.ability.Want'; @Entry @Component struct Index { build() { Row() { Column() { Button('拉起蓝牙页面', { type: ButtonType.Normal, stateEffect: true }) .borderRadius(8) .backgroundColor(0x317aff) .width(90) .onClick(() => { this.startAbilityTest() }) } .width('100%') } .height('100%') } startAbilityTest() { let context = getContext(this) as common.UIAbilityContext; let want: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: 'bluetooth_entry', }; context.startAbility(want); } }
示例代码