优化utils

This commit is contained in:
TOP糯米 2023-03-07 00:26:20 +08:00
parent db8df33436
commit 38b4688b09
1 changed files with 18 additions and 3 deletions

View File

@ -154,11 +154,26 @@ function rpx2px(rpx) {
return (rpx / 750) * windowWidth;
}
function toPage(url, options) {
uni.navigateTo({
function toPage(url, options, type) {
if (typeof type === "undefined") {
type = "navigate";
}
let params = {
...{ url: url, },
...options
});
};
switch (type) {
case "relaunch":
uni.reLaunch(params);
break;
case "redirect":
uni.redirectTo(params);
break;
case "navigate":
default:
uni.navigateTo(params);
break;
}
}
function toast(title, options) {