From 38b4688b091ffd075575a81bd9ee56871c27d98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com> Date: Tue, 7 Mar 2023 00:26:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96utils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/libs/utils.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/core/libs/utils.js b/src/core/libs/utils.js index 7c2eb38..b4ce6db 100644 --- a/src/core/libs/utils.js +++ b/src/core/libs/utils.js @@ -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) {