在引用vue作为一个插件时,使用$http获取数据时报错
Failed to load http://****/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';
即可解决!