From 049d2601f984505dbbbbb6cb5fe68a363e060d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Thu, 22 May 2025 15:47:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(XWebview):=20=E6=B7=BB=E5=8A=A0=E5=BD=93?= =?UTF-8?q?=E5=89=8D=20url=20=E8=B7=B3=E8=BD=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 XWebview 组件中实现了当前 url 跳转的功能 - 通过 GlobalContext 获取全局上下文,调用 openLink 方法进行跳转 - 优化了用户体验,增加了页面跳转的灵活性 --- src/main/ets/pages/XWebview.ets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/ets/pages/XWebview.ets b/src/main/ets/pages/XWebview.ets index 3d74398..039e197 100644 --- a/src/main/ets/pages/XWebview.ets +++ b/src/main/ets/pages/XWebview.ets @@ -12,6 +12,7 @@ import { SZYXLocalStorageHelper } from '../utils/SZYXLocalStorageHelper'; import { SZYXLocalStorageKeys } from '../utils/SZYXLocalStorageKeys'; import { XWebManager } from '../utils/XWebManager'; import { TitleBarBtn } from '../view/SafeView'; +import { GlobalContext } from '../ContextConfig'; @Entry({ routeName: 'XWebview' }) @Component @@ -378,7 +379,7 @@ export struct XWebview { if (index === 0) { this.controller.refresh() } else if (index === 1) { - + GlobalContext.getContext().openLink(this.controller.getUrl()) } else { pasteboard.getSystemPasteboard() .setData(pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.controller.getUrl()), () => {