PrivacyPage.ets 2.05 KB

import webview from '@ohos.web.webview';
import router from '@ohos.router';
import { GlobalContext } from '../common/utils/GlobalContext'

@Entry
@Component
struct PrivacyPage {
  @State message: string = 'Hello World'
  webController: webview.WebviewController = new webview.WebviewController();
  //@State params: object = router.getParams();

  build() {
    Row() {
      Column() {
        // Web component loading H5.
        Web({ src: 'https://www.baidu.com', controller: this.webController })
          .zoomAccess(false)
          .width('100%')
          .height('100%')
          .aspectRatio(1)
          // .onConfirm((event) => {
          //   AlertDialog.show({
          //     message: Const.WEB_ALERT_DIALOG_TEXT_VALUE + event?.message,
          //     confirm: {
          //       value: $r('app.string.web_alert_dialog_button_value'),
          //       action: () => {
          //         event?.result.handleConfirm();
          //       }
          //     },
          //     cancel: () => {
          //       event?.result.handleCancel();
          //     }
          //   });
          //   return true;
          // })
          // .onErrorReceive((event) => {
          //   if (event?.error.getErrorInfo() === 'ERR_INTERNET_DISCONNECTED') {
          //     prompt.showToast({
          //       message: $r('app.string.internet_err'),
          //       duration: Const.WebConstant_DURATION
          //     })
          //   }
          //   if (event?.error.getErrorInfo() === 'ERR_CONNECTION_TIMED_OUT') {
          //     prompt.showToast({
          //       message: $r('app.string.internet_err'),
          //       duration: Const.WebConstant_DURATION
          //     })
          //   }
          // })
          // .onProgressChange((event) => {
          //   if (event?.newProgress === Const.WebConstant_PROGRESS_MAX) {
          //     this.isLoading = false;
          //     clearInterval(this.intervalLoading);
          //     this.intervalLoading = -1;
          //   }
          // })
      }
      .width('100%')
    }
    .height('100%')
  }
}