let isGoing = false
export default {
navigateTo(config){
console.log(6666,config,isGoing)
if(isGoing){
return true
}else{
console.log(7777777)
isGoing = true
uni.navigateTo({
...config,
complete() {
console.log(99999)
isGoing=false
}
});
}
}
}
- 发布:2020-08-05 18:00
- 更新:2020-08-05 18:00
- 阅读:672
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: window7
HBuilderX类型: 正式
HBuilderX版本号: 2.8.3
手机系统: Android
手机系统版本号: Android 10
手机厂商: 华为
手机机型: p20
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
complete之后才可以,打开新页面
complete之后才可以,打开新页面
实际结果:
17:50:37.108 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] false at utils/myRouter.js:4
17:50:37.128 [Number] 7777777 at utils/myRouter.js:8
17:50:37.170 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] true at utils/myRouter.js:4
17:50:37.208 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] true at utils/myRouter.js:4
17:50:37.289 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] true at utils/myRouter.js:4
17:50:37.609 [Number] 99999 at utils/myRouter.js:13
log虽然正常但是页面被重复打开多次,当不出
17:50:37.108 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] false at utils/myRouter.js:4
17:50:37.128 [Number] 7777777 at utils/myRouter.js:8
17:50:37.170 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] true at utils/myRouter.js:4
17:50:37.208 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] true at utils/myRouter.js:4
17:50:37.289 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] true at utils/myRouter.js:4
17:50:37.609 [Number] 99999 at utils/myRouter.js:13
log虽然正常但是页面被重复打开多次,当不出
bug描述:
自己加上判断还是不行的,重写了navigateTo,手机华为P20
navigateTo(config){
console.log(6666,config,isGoing)
if(isGoing){
return true
}else{
console.log(7777777)
isGoing = true
uni.navigateTo({
...config,
complete() {
console.log(99999)
isGoing=false
}
});
}
},
输出的log:
17:50:37.108 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] false at utils/myRouter.js:4
17:50:37.128 [Number] 7777777 at utils/myRouter.js:8
17:50:37.170 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] true at utils/myRouter.js:4
17:50:37.208 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] true at utils/myRouter.js:4
17:50:37.289 [Number] 6666 , [Object] {"url":"/pages/pwdLogin/pwdLogin"} , [Boolean] true at utils/myRouter.js:4
17:50:37.609 [Number] 99999 at utils/myRouter.js:13
虽然complete只执行了一次,但是打开了两次页面
是我写法有问题吗?求大佬,官方解决
0 个回复