簡體   English   中英

本地主機-僅協議方案支持跨源請求?

[英]localhost - Cross origin requests are only supported for protocol schemes?

我有以下功能:

this.Locations = axios.get('localhost:8081/fetchData?table=locations').then((res) => {                                         
  return res
})   

在我的app.js中,我設置了一個端點“ / fetchData”,如果我只是在瀏覽器中執行,該端點就可以正常工作。

我怎么會收到此錯誤消息?

Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

您需要指定一個方案,例如http:// 將功能更改為:

this.Locations = axios.get('http://localhost:8081/fetchData?table=locations').then((res) => {                                         
  return res
})   

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM