UNPKG

cc-ui-uni-app

Version:

cc-ui, uni-app组件库, 一切为了简单

38 lines (36 loc) 625 B
const http = ({ url, data, header, method = 'GET', timeout = 60000, showLoading = true, loadtingText = '加载中...' }) => { if (showLoading) { uni.showLoading({ title: loadtingText }) } return new Promise((resolve, reject) => { uni.request({ url, data, header, method, timeout, success: res => { resolve(res.data) }, fail: err => { reject(err) }, complete: () => { if (showLoading) { uni.hideLoading() } } }) }) } export default http