3 Answers

我的意思是,就算不支持大于5M的文档,save()应该返回rejected 而不是一直pending状态

后面追加一个

        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 。。。。