如何解决Vue中用$http获取数据时出现的错误问题?

2026-04-05 19:470阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计143个文字,预计阅读时间需要1分钟。

如何解决Vue中用$http获取数据时出现的错误问题?

在用Vue插件时,使用$http获取数据时遇到错误:Failed to load http://*.*.*.*:***/ajaxGrainRain: Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response. 需要在后台添加add_。

如何解决Vue中用$http获取数据时出现的错误问题?

在引用vue作为一个插件时,使用$****/ajaxGrainRain: Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.

只需在后台加上

add_header 'Access-Control-Allow-Headers' 'DNT, X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';

即可解决!

以上这篇vue解决使用$http获取数据时报错的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持易盾网络。

标签:问题

本文共计143个文字,预计阅读时间需要1分钟。

如何解决Vue中用$http获取数据时出现的错误问题?

在用Vue插件时,使用$http获取数据时遇到错误:Failed to load http://*.*.*.*:***/ajaxGrainRain: Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response. 需要在后台添加add_。

如何解决Vue中用$http获取数据时出现的错误问题?

在引用vue作为一个插件时,使用$****/ajaxGrainRain: Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.

只需在后台加上

add_header 'Access-Control-Allow-Headers' 'DNT, X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';

即可解决!

以上这篇vue解决使用$http获取数据时报错的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持易盾网络。

标签:问题