目前不支持直接跳转,替代方案可以通过H5调用应用侧方法实现。import web_webview from ‘@ohos.web.webview’; import call from ‘@ohos.telephony.call’; import { BusinessError } from ‘@ohos.base’; @Entry @Component struct WebComponent { webviewController: web_webview.WebviewController = new web_webview.WebviewController(); build() { Column() { Web({ src: $rawfile(‘call.html’), controller: this.webviewController}) .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="xxx">拨打电话</a> </div> </body> </html> 在Web组件的H5页面中,如何使用a标签实现打开各种页面:https://developer.huawei.com/consumer/cn/doc/harmonyos-faqs-V5/faqs-arkweb-41-V5
目前不支持直接跳转,替代方案可以通过H5调用应用侧方法实现。
call.html:
在Web组件的H5页面中,如何使用a标签实现打开各种页面:https://developer.huawei.com/consumer/cn/doc/harmonyos-faqs-V5/faqs-arkweb-41-V5