我正在尝试一个 HTTP 请求,但是导入axios模块时出错,我不知道错误是什么。
我检查了所有代码并查找了缺陷,但没有发现缺陷。
import axios from 'axios';
class Api {
static async getChannelInfo(){
try{
const response = await axios.get('https://...');
console.log(response);
} catch (err){
console.log('...');
}
}
}
Api.getChannelInfo();
错误:
期望该代码返回具有API数据的JSON,但返回第1行指示的控制台错误:Uncaught SyntaxError:意外标识符。