优化utils
This commit is contained in:
parent
db8df33436
commit
38b4688b09
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue