axios 的写法
get:
axios.get('/user', { params: { ID: 12345 }
})
.then(res=>{ console.log(res)})
.catch(rej=>{ console.log(rej)})
或:
axios({ method: 'get', url: '/user/12345', params: { firstName: 'Fred', lastName: 'Flintstone' } })
post:
axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' })
.then(res=>{ console.log(res)})
.catch(rej=>{ console.log(rej)})
或:
axios({ method: 'post', url: '/user/12345', data: { firstName: 'Fred', lastName: 'Flintstone' } });
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步