参考demo:import webView from '@ohos.web.webview' import { call } from '@kit.TelephonyKit'; import { BusinessError } from '@kit.BasicServicesKit'; Web({ src: $rawfile('call.html'), controller: this.controller }) .height(500) .onLoadIntercept((event) => { if (event) { let url: string = event.data.getRequestUrl(); // 判断链接是否为拨号链接 if (url.indexOf('tel://') === 0) { call.makeCall(url.substring(6), (err: BusinessError) => { if (!err) { console.log('make call success.'); } else { console.log('make call fail, err is:' + JSON.stringify(err)); } }); return true; } } return false; })// call.html: <!DOCTYPE html> <html> <body> <div> <a href="tel://xxxx">拨打电话</a> </div> </body> </html>
参考demo: