导致这一问题的根本原因是 Mockjs 中, 封装了原生的 XMLHttpRequest 为 MockXMLHttpRequest.
解决思路是, 把原生 XMLHttpRequest 的 upload 属性赋给 MockXMLHttpRequest 的原型对象.在 node_modules/mockjs/dist/mock.js 加入以下代码:
Axios + mockjs: request.upload.addEventListener is not a function 的原因和解决办法
这样在开发环境是没问题了.
对于生产环境的处理 (如果需要),
Axios + mockjs: request.upload.addEventListener is not a function 的原因和解决办法

REF:
https://github.com/nuysoft/Mock/issues/127

相关文章:

  • 2022-12-23
  • 2021-08-08
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2021-07-10
  • 2022-12-23
猜你喜欢
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
相关资源
相似解决方案