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

 mobiledu2502858053 发布于 2022-11-27 12:45

使用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属性
查了很久了,试了很多方法都无效,请问是什么问题??

1 个回答
  • 把路由配置的get改为post

    但这样只能用post
    我是写了俩

    2022-11-27 13:02 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有