/** 串行化上传,避免微信 JSSDK 并发选图/读图导致卡死 */ let uploadChain: Promise = Promise.resolve(); export function enqueueUpload(task: () => Promise): Promise { const next = uploadChain.then(task, task); uploadChain = next.then( () => undefined, () => undefined, ); return next; }