Browse Source

[优化] 全局$url增加节流防抖

master
LAPTOP-D7TKRI82\邓 4 years ago
parent
commit
841adc5f28
  1. 23
      common/mixin.js

23
common/mixin.js

@ -70,18 +70,19 @@ export default{
}); });
}, },
$url(url, options = {}){ $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(){ $toBack(){
let pages = getCurrentPages(); // 当前页 let pages = getCurrentPages(); // 当前页

Loading…
Cancel
Save