安装依赖 $ yarn add isomorphic-fetch 新建utils/Requst.js 文件 import fetch from 'isomorphic-fetch' // this is base_url, you can set webpack /*** new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify(env),//production development 'BASE_API_ENDPOINT' : JSON.stringify('') // here , watch env }, }), ***/ // or set .env and .env.production /*** BASE_API_ENDPOINT=http://192.**.1.**:8849 // inner .env BASE_API_ENDPOINT=http://192.**.4.**:8849 // inner .env.production ***/ const BASE_URL = process.env.BASE_API_ENDPOINT // content-type const ContentType = { JSON: "application/json; charset=UTF-8", FORM: "application/x-www-form-urlencoded; charset=UTF-8" } // Http method const HttpMethod = { GET : "GET", POST : "POST", PUT : "PUT", PATCH : "PATCH", DELETE : "DELETE" } // common check const checkStatus = re