index.js 455 B

12345678910111213141516
  1. // 引入配置
  2. import config from '@/common/config'
  3. // 初始化请求配置
  4. uni.$u.http.setConfig((defaultConfig) => {
  5. /* defaultConfig 为默认全局配置 */
  6. defaultConfig.baseURL = config.baseUrl /* 根域名设置接口请求域名 */
  7. defaultConfig.header={
  8. 'content-type': 'application/json'
  9. }
  10. return defaultConfig
  11. })
  12. module.exports = (vm) => {
  13. require('./requestInterceptors')(vm)
  14. require('./responseInterceptors')(vm)
  15. }