javascript - JSON中位置0处的意外令牌<。获取函数VueJS
问题描述
伙计们,我在使用这个 fetch 功能时遇到了麻烦
fetchWeather() {
fetch(`${this.url_base}weather?q=${this.query}&units=metric&APPID=${this.api_key}`)
.then(res => {
return res.json()
}).then(this.setResults)
},
setResults(results) {
this.weather = results
},
它说“Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0”
我做错了什么?
解决方案
推荐阅读
- keycloak - 钥匙斗篷模拟
- ios - 如何设置/更改 CGImage 上的 alphaInfo?
- reactjs - React 项目无法在 git 子模块中使用节点模块
- tensorflow - 为什么 SSD 在数据增强期间会调整随机作物的大小?
- java - 从 EC 点和 ECParameterSpec 构造 EC 公钥会给出无效的 x 值
- ios - Flutter on Mac OS 软件包问题
- python - 为什么安装pysam python包失败?
- arrays - 从 Bash 中的命令输出创建二维数组
- python - 语音到文本识别:Python 中的文本校正和结果即兴创作
- python - Numba 抱怨打字 - 但提供了所有类型