From 841adc5f28c159ac4a2acb4d17ba1bb8a6ad70ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LAPTOP-D7TKRI82=5C=E9=82=93?= <52643018@qq.com> Date: Wed, 23 Jun 2021 09:59:41 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E5=85=A8=E5=B1=80$url?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8A=82=E6=B5=81=E9=98=B2=E6=8A=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/mixin.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/common/mixin.js b/common/mixin.js index f7303db..0a87aa9 100644 --- a/common/mixin.js +++ b/common/mixin.js @@ -70,18 +70,19 @@ export default{ }); }, $url(url, options = {}){ - // TODO 判断登录逻辑;防抖 - if(options.type && options.type !== ''){ - if(options.type === 'redirect'){ // 关闭当前,跳转 - uni.redirectTo({ url }) - }else if(options.type === 'switch'){ // 跳转 - uni.switchTab({ url }) - }else if(options.type === 'launch'){ // 关闭所有,跳转 - uni.reLaunch({ url }) + this.$u.throttle(() => { + if(options.type && options.type !== ''){ + if(options.type === 'redirect'){ // 关闭当前,跳转 + uni.redirectTo({ url }) + }else if(options.type === 'switch'){ // 跳转 + uni.switchTab({ url }) + }else if(options.type === 'launch'){ // 关闭所有,跳转 + uni.reLaunch({ url }) + } + }else{ + uni.navigateTo({ url }) // 跳转 } - }else{ - uni.navigateTo({ url }) // 跳转 - } + }, 100); }, $toBack(){ let pages = getCurrentPages(); // 当前页