如何通過(guò)getColor函數(shù)返回onload事件函數(shù)的返回值呢?console.log(getColor(URL));
function getColor (URL) {
const image = new Image()
image.onload = function(){
return {color: 'red'}
}
image.src = URL
}求助,謝謝??!
如何從外部獲取異步函數(shù)內(nèi)部的返回值?
叮當(dāng)貓咪
2018-10-04 14:19:42