From 3df1f75763d8d32983d905208257da4a19cc1d46 Mon Sep 17 00:00:00 2001 From: SimpleLove520 <1960997571@qq.com> Date: Mon, 14 Oct 2024 15:52:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DInAppWebView=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96initialData=E6=97=B6=EF=BC=8Chtml=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=B2=A1=E6=9C=89=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SimpleLove520 <1960997571@qq.com> --- .../plugin/webview/in_app_webview/InAppWebView.ets | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/flutter_inappwebview_ohos/ohos/src/main/ets/components/plugin/webview/in_app_webview/InAppWebView.ets b/flutter_inappwebview_ohos/ohos/src/main/ets/components/plugin/webview/in_app_webview/InAppWebView.ets index c9aace06..c533bee1 100644 --- a/flutter_inappwebview_ohos/ohos/src/main/ets/components/plugin/webview/in_app_webview/InAppWebView.ets +++ b/flutter_inappwebview_ohos/ohos/src/main/ets/components/plugin/webview/in_app_webview/InAppWebView.ets @@ -886,13 +886,9 @@ export default class InAppWebView implements InAppWebViewInterface { async loadDataWithBaseURL(baseUrl: string, data: string, mimeType: string, encoding: string, historyUrl: string) { await this.waitControllerAttached(); - if (baseUrl && historyUrl) { - this.controller.loadData(data, mimeType, encoding, baseUrl, historyUrl) - } else if (baseUrl) { - this.controller.loadData(data, mimeType, encoding, baseUrl) - } else { - this.controller.loadData(data, mimeType, encoding) - } + baseUrl ??= "about:blank"; + historyUrl ??= "about:blank"; + this.controller.loadData(data, mimeType, encoding, baseUrl, historyUrl) } getController(): web_webview.WebviewController { -- Gitee