Vue-Superagent.post 不是函数

Vue-Superagent.post is not a function

我正在使用 vue-superagent 上传文件。我有这段代码之前可以工作但是现在我收到错误:

vue_superagent__WEBPACK_IMPORTED_MODULE_5___default.a.post is not a function

//@ts-ignore
import VueSuperagent from "vue-superagent";

onUpload(): void {
    if(this.fileChosen){
      const fd = new FormData();
      fd.append("file", this.selectedFile, this.selectedFile.name);
      VueSuperagent.post("http://localhost:8080/routes").attach("file", fd);
    } else {
      this.fileMsg = "You haven't chosen a file";
    }
  }

我无法弄清楚我在代码中更改了什么导致出现此错误。感觉就像它在一天工作,然后在它给了我这个错误后的第二天。这就是为什么我有点不知道如何解决这个问题。

我试过重新安装软件包,但它一直给我错误。

the documentation所示,预计用作:

import Vue from 'vue'
import VueSuperagent from 'vue-superagent'

Vue.use(VueSuperagent)

...

Vue.superagent.post(...)

否则使用vue-superagent没有意义,如果打算在Vue之外使用superagent那么应该直接使用superagent