// 封装axios请求,返回promise, 用于调用getHistoryData函数后作不同处理
getHistoryData (data) {
return new Promise((resolve, reject) => {
axios.get('/api/survey/list/', {
params: data
}).then((res) => {
resolve(res)
}).catch((err) => {
reject(err)
})
})
}
async test(){
let result = await getHistoryData()
consolog(result)
}
正文结束
Ctrl + Enter