标签:await 编译 style 提升 datetime dup 定义 param UNC
1 async addPageVersion(uuid, param) { 2 let result = await this.getVersions(uuid, {pageData: param.pageData}); 3 if(result&&result.length) { 4 //更新时间 5 let result = await to(Pageversion.findOneAndUpdate({uuid,pageData: param.pageData}, {updateTime: param.updateTime})); 6 }else{ 7 //添加 8 let res = await this.getVersions(uuid); 9 10 let { uuid, lastAuthor, pageData, updateTime, imgUrl } = param; 11 let pageVersion = new Pageversion({uuid,lastAuthor, pageData,updateTime, imgUrl}); 12 result = await to(pageVersion.save()); 13 } 14 }
if里面可以获取到参数uuid,但是在else里面我们的参数uuid会为undefine??
function a(uuid) { if(..) { ... } else { let uuid; console.log(uuid); uuid = ??; } }
标签:await 编译 style 提升 datetime dup 定义 param UNC
原文地址:https://www.cnblogs.com/longlongdan/p/11504984.html