写在前面
使用方法(链接的博客写得很详细)
- 安装
npm install superagent --save
- 导入
import ajax from 'superagent';//ajsx那里可以取任意名字
- 使用(单独写成函数就可以直接调用)
ajax.get('http://xxxxxxxxxxxx') .end((error, response) => { if (!error && response) { console.log('response',response.body.data); } else { console.log('There was an error fetching from GitHub', error); } } );
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/233366.html原文链接:https://javaforall.net