map的回调函数内部用return语句,返回给了map内部的匿名函数,外层的getCapture函数没有接到,所以返回的是空,修改成这样接收: //getCapture函数内部 const mappedResult = result.map(m => { if (m.name === '整个屏幕') { console.log(m) let str = m.thumbnail.crop({x: 0, y: 0, width: 1000, height: 1000}) const imgStr = str.toDataURL() return imgStr } return undefined; }); return mappedResult.find(imgStr => imgStr !== undefined);