我正在嘗試在 react-native 中本地獲取 laravel API。當(dāng)我嘗試使用遠(yuǎn)程 url 時(shí),它可以工作,但不能與本地服務(wù)器一起使用。我正在使用 android studio 模擬器和react-native => 0.59.8, laravel => 5.7我的代碼 async submit() { //https://facebook.github.io/react-native/movies.json => this works try { let response = await fetch('localhost:8000/api/coins'); let responseJsonData = await response.json(); console.log(responseJsonData, 'data'); } catch (e) { console.log(e, 'error') }};錯(cuò)誤05-20 14:46:08.167 4749 8885 I ReactNativeJS: { [TypeError: Network request failed]05-20 14:46:08.167 4749 8885 I ReactNativeJS: line: 24115,05-20 14:46:08.167 4749 8885 I ReactNativeJS: column: 31,05-20 14:46:08.167 4749 8885 I ReactNativeJS: sourceURL: 'http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false' }, 'error'
React Native Fetch 不能在本地使用 laravel API
qq_笑_17
2021-06-19 18:14:26