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