Open lihuikun opened 1 year ago
这样写即可:
/** * @param e * @param insertImage * @param {File[]} files */ async handleUploadImage(e, insertImage, files) { for (const file of files) { await this.upload(file).then(res => { insertImage({ url: res.url, desc: res.desc }); }); } }, /** * 模拟http请求上传图片 * @param {File} file * @return {Promise<{url: string, desc: string}>} */ upload(file) { return new Promise((resolve) => { resolve({ url: file.name, desc: file.name, }); }); },
这样写即可: