vue解决使用$http获取数据时报错的问题

网络编程 2021-07-04 15:02www.168986.cn编程入门
今天长沙网络推广就为大家分享一篇vue解决使用$http获取数据时报错的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随长沙网络推广过来看看吧

在引用vue作为一个插件时,使用$http获取数据时报错

Failed to load http://****/ajaxGrainRain:
Request header field Content-Type is not allowed by Aess-Control-Allow-Headers in preflight response.

只需在后台加上

add_header 'Aess-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获取数据时报错的问题就是长沙网络推广分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持狼蚁SEO。

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by