后面追加一个
const _res = wpsSdk.save();
console.log("🚀 ~ downloadAfterSaving ~ res:", _res);
_res.then(async(e) => {
console.log("🚀 ~ downloadAfterSaving ~ done e: then", e);
const isSuccess = ["nochange", "ok"].includes(e.result);
this.download("https://ideafusion.oss-cn-shenzhen.aliyuncs.com/design-project/materiaBook/1711535158198/直播演示.docx"),
//下载
download(url) {
try {
let a = document.createElement("a");
a.href = url;
// a.download = fileName
a.click();
console.log("🚀 ~ returnPromise.resolve ~ a.href:", a.href);
} catch (error) {
console.error("🚀 ~ download ~ error:", error);
}
},
这里 save必现 一直处于pending状态
加了下面的代码
a.target = '_blank' a.click();
这样下次调用save,promise就不会一直处于pending 。。。。