feat: 路由跳转的优化

This commit is contained in:
zoujing committed 2026-07-16 21:16:48 +08:00
1 parent 99151bca58
commit 39c4e75de5
1 file changed
+11 -3
+11 -3
View File
@@ -15,7 +15,15 @@ export function navigateTo(url, args) {
} }
} }
console.log("Navigating to URL:", targetUrl); console.log("Navigating to URL:", targetUrl);
uni.navigateTo({ if (url.startsWith("http://") || url.startsWith("https://")) {
url: "/pages/webview/index?url=" + encodeURIComponent(targetUrl), // 如果是外部链接,使用webview打开
}); uni.navigateTo({
url: "/pages/webview/index?url=" + encodeURIComponent(targetUrl),
});
} else {
// 否则,直接跳转到内部页面
uni.navigateTo({
url: targetUrl,
});
}
} }