未捕获(按承诺)TypeError:无法获取reactjs

时间:2019-06-26 08:26:02

标签: reactjs cors

未捕获(承诺)TypeError:无法获取ReactJS

我厌倦了将代码更改为

type A(name:string)
    = member this.Name = name

type T(name:string)
    = member this.Name = name

type TK(t:T, a:List<A>) =
    member this.T = t
    member this.A = a

type TM =
    | T of T 
    | A of A 
    | G of List<T>

let a = A("A1")

错误将显示在本地主机中,

起源'http://localhost:3000'的api url 已被CORS策略阻止:飞行前响应中Access-Control-Allow-Headers不允许请求标头字段access-control-allow-origin。< / strong>

未捕获(承诺)TypeError:无法获取

1 个答案:

答案 0 :(得分:0)

您正在通过节点js获取数据吗?通常,您需要在后端允许CORS