feat: 路由跳转的优化
This commit is contained in:
@@ -15,7 +15,15 @@ export function navigateTo(url, args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("Navigating to URL:", targetUrl);
|
console.log("Navigating to URL:", targetUrl);
|
||||||
|
if (url.startsWith("http://") || url.startsWith("https://")) {
|
||||||
|
// 如果是外部链接,使用webview打开
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/webview/index?url=" + encodeURIComponent(targetUrl),
|
url: "/pages/webview/index?url=" + encodeURIComponent(targetUrl),
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// 否则,直接跳转到内部页面
|
||||||
|
uni.navigateTo({
|
||||||
|
url: targetUrl,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user