async await
总是记不住async和await。一个栗子就想起来了。
function getFinal(){ getCode().then(function(res){ if(res.data.code == 0){ var params = { code:res.data.code } getlist(params).then(function(res){ if(res.data.code == 0){ } }) } }) } getFinal();
async function getResult(){ let code = await getCode(); if(code.data.code == 0){ var params = { code:code.data.code } let list = await getlist(params); } } getResult();