用uniapp 写APP、怎么接口请求错误了,在H5上面是能请求成功的 const pre = "Bearer "; const request = (options = {}) => { let token = uni.getStorageSync("token"); options.header["Accept"] = "application/json, text/plain, */*"; options.header["Authori-zation"] = pre + uni.getStorageSync("token"); return new Promise((resolve, reject) => { //获取接口的全连接 uni.request({ url: options.url, //仅为示例,并非真实接口地址。 method: options.type || "GET", data: options.data || {}, header: options.header || {}, success: (res) => { const { code, result, other, msg, status } = res.data; if (status == 410000 || status == 410001 || status == 410002) { uni.clearStorage(); resolve({ msg, status, result }); return } if (status !== 200 && options.loading) { uni.showToast({ title: msg, icon: "error", }); resolve({ msg, status, result }); } else { resolve({ result, other, msg, status }); } }, complete: (e) => { if (options.loading) { uni.hideLoading(); } }, }); }); }; const post = ( url, data, loading = true, options = { header: {}, } ) => { options.type = "POST"; options.data = data; options.url = url; options["loading"] = loading; options.header["content-type"] = "application/json"; return request(options); }; export { post }; 在手机模拟器上面报错的信息是: {"errMsg":"request:fail abort statusCode:-1 Expected URL scheme 'http' or 'https' but was 'file'"}