中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
web组件加载https://emuserh5.eastmoney.com/UserAgreement/fwxy异常
微信扫码分享
import { authentication } from ‘@kit.AccountKit’; import { BusinessError } from ‘@kit.BasicServicesKit’; import { hilog } from ‘@kit.PerformanceAnalysisKit’; import web_webview from ‘@ohos.web.webview’; import business_error from ‘@ohos.base’; @Entry @Component struct Index { webviewController: web_webview.WebviewController = new web_webview.WebviewController(); build() { Column() { Button(‘loadUrl’) .onClick(() => { try { // 点击按钮时,通过loadUrl,跳转到www.example1.com this.webviewController.loadUrl(‘https://emuserh5.eastmoney.com/UserAgreement/fwxy’); } catch (error) { let e: business_error.BusinessError = error as business_error.BusinessError; console.error(ErrorCode: ${e.code}, Message: ${e.message}); } }) // 组件创建时,加载www.example.com Web({ src: ‘https://emuserh5.eastmoney.com/UserAgreement/fwxy’, controller: this.webviewController}) } } }