首页 > vue-router $http.get 调用本地数据 404 怎么解决

vue-router $http.get 调用本地数据 404 怎么解决

vue-router $http.get 调用本地数据 404 怎么解决

this.$http.get('../assets/listinfo.json', {}).then((data) => {
        _this.successCallback()
      }, (response) => {
        _this.errorCallback()
      })

json

可能是浏览器默认禁止本地浏览ajax,但不知怎么解决


其实可以自己开个本地服务,然后使用 proxy 转到本地服务上.测试起来更方便.


好像是因为不支持本地ajax请求,跨域试下


我也遇到了这个问题,我看到配置的路径都没问题啊@楼上


可以试试如下:

Vue.http.options.root = '/assets/'

404只能是 该文件不存在,或路由没配好

【热门文章】
【热门文章】