0
点赞
收藏
分享

微信扫一扫

Vue项目—请求函数的封装

ivy吖 2022-07-12 阅读 86

Vue项目—请求函数的封装

Vue项目—请求函数的封装_ios

import axios from 'axios'

export const post = (url, data = {}) => {
return new Promise((resolve, reject) => {
axios.post(url, data, {
baseURL: 'https://www.fastmock.site/mock/ae8e9031947a302fed5f92425995aa19/jd',
headers: {
'Content-Type': 'application/json'
}
}).then((response) => {
resolve(response.data)
}, err => {
reject(err)
})
})
}


举报

相关推荐

0 条评论