本地上传文件不会报错,但是线上会报错URL.createObjectURL is not a function是什么原因呢?

使用的是element-ui组件库的upload组件,在本地运行的时候上传文件不会报错,但是线上测试的时候回报如下错误。这和element-ui有关系吗?该怎么解决?

chunk-elementUI.79b3fab8.js:1 [Element Error][Upload] TypeError: URL.createObjectURL is not a function
    at a.handleStart (chunk-elementUI.79b3fab8.js:1:438036)
    at chunk-elementUI.79b3fab8.js:1:434423
    at Array.forEach (<anonymous>)
    at a.uploadFiles (chunk-elementUI.79b3fab8.js:1:434400)
    at a.handleChange (chunk-elementUI.79b3fab8.js:1:434158)
    at ne (chunk-libs.a2dc0de0.js:29:11664)
    at HTMLInputElement.n (chunk-libs.a2dc0de0.js:29:13484)
    at HTMLInputElement.Qi.o._wrapper (chunk-libs.a2dc0de0.js:29:51766)
阅读 4.3k
2 个回答

可能是打包的问题,有可能打包的时候URL被重写了,在用它之前先打印一下URL和URL.createObjectURL,看存在不

是服务器端渲染吗?Node环境里面好像没有URL.createObjectURL

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题