vue-resource中使用post方法请求json报404错误

使用vue-resource请求json文件时,使用get方法是可以获取到的

this.$http.get('./static/json/banner.json')
    .then((response) => {
        console.log(response.data);
    }).catch((response) => {
        console.log(response);
    });

但是使用post就报404错误了

this.$http.post('./static/json/banner.json', {})
    .then((response) => {
        console.log(response.data);
    }).catch((response) => {
        console.log(response);
    });

修改过emulateJSON属性与emulateHTTP属性
将路径改成http://localhost:8080/static/...
给实例修改过headers属性
查了很久了,试了很多方法都无效,请问是什么问题??

阅读 7.5k
1 个回答
新手上路,请多包涵

把路由配置的get改为post
clipboard.png
但这样只能用post
我是写了俩

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