解决element Upload 上传 出现Access to XMLHttpRequest at
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
Access to XMLHttpRequest at ‘http://192.168.12.119/api/design/upload_img’ from origin ‘http://localhost:8080’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
问题的原因是出现了跨域,但是针对 这里element upload的话,有别的处理办法
先看upload中代码
<el-upload
ref="upload"
action="http://192.168.249.199/api/design/upload_img"
:on-preview="handlePreview"
:on-remove="handleRemove"
:file-list="fileList"
:auto-upload="false"
:data="projects_list[0]"
:headers="file_headers"
accept=".jpg,.jpeg,.png"
>
我是写全了请求地址
意思就是不用写全请求地址就不会出现跨域错误了,改了之后
控制台正常了
如果需要解决跨域查看文章:https://editor.csdn.net/md/?articleId=112295248
希望对你有帮助!!
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45
7 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 7 个月前
更多推荐
已为社区贡献18条内容
所有评论(0)