GET请求上的Laravel Vue Access-Control-Allow-Origin错误

时间:2019-05-11 04:45:20

标签: laravel vue.js cors axios

我试图使用Laravel和Vue从数据库中显示产品。

created(){
        let uri=`http://127.0.0.1:8000/api/products`;
        axios.get(uri).then((response)=>{
            this.products=response.data
        },
        (error) => { console.log(JSON.stringify(error))  }
        )
        }

但是它给出了以下错误

  

{“ config”:{“ transformRequest”:{},“ transformResponse”:{},“超时”:0,“ xsrfCookieName”:“ XSRF-TOKEN”,“ xsrfHeaderName”:“ X-XSRF-TOKEN” ,“ maxContentLength”:-1,“标头”:{“ Accept”:“ application / json,   文字/纯文字,    / “,” X-Requested-With“:” XMLHttpRequest“},” method“:” get“,” url“:” http://127.0.0.1:8000/api/products“},” request“:{} }

0 个答案:

没有答案
相关问题