goHome && (await router.replace(PageEnum.BASE_HOME));
&&
这个逻辑与的作用是,当goHome
为true时,执行右边的代码,否则就不会执行右边的代码async function f(flag=false){
flag && console.log(‘hi‘)
console.log(‘hello‘)
}(f());
true
后:async function f(flag=false){
flag && console.log(‘hi‘)
console.log(‘hello‘)
}(f(true));
原文:https://www.cnblogs.com/baiyifengyun/p/15113745.html