优化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; return (rpx / 750) * windowWidth;
} }
function toPage(url, options) { function toPage(url, options, type) {
uni.navigateTo({ if (typeof type === "undefined") {
type = "navigate";
}
let params = {
...{ url: url, }, ...{ url: url, },
...options ...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) { function toast(title, options) {