vue-cli is configured with axios,post request. No problem. Get request will return undefined, for advice
/ / return a Promise (send get request)
export function fetchGet (url, param) {
return new Promise((resolve, reject) => {
axios.get(url, {params: param})
.then(response => {
resolve(response.data)
}, err => {
reject(err)
})
.catch((error) => {
reject(error)
})
})
}
/ / Encapsulation api
getBankName (p) {
return fetchGet("api/rong360BankName", p)
}
calls this API, and the returned undefined, shows that the interface is called successfully
async choicesBankName () {
const aa = await api.getBankName()
console.log(aa)
},
finally, I wish you all a happy Valentine"s Day, and programmers who have to type code on Valentine"s Day