参考示例如下:import call from '@ohos.telephony.call'; import { BusinessError } from '@ohos.base'; function startCallDialog(): void { let isSupport = call.hasVoiceCapability(); if (!isSupport) { console.error('Not support voice capability.'); return; } call.makeCall('电话号码', (err: BusinessError) => { if (err) { console.error(`Failed to make call. Code is ${err.code}, Message is ${err.message}`); return; } console.info('Succeeded in making call.'); }) } @Entry @Component struct Phone { build() { Row() { Column() { Button('拨打电话') .onClick(() => { startCallDialog(); }) } .width('100%') } .height('100%') } }
参考示例如下: