vue2 重新对封装好的axios的baseUrl赋值

api.js

import request from '@/base/service'

const baseURL = process.env.VUE_APP_API
const requestClue = (data) => {
  return request({
    ...data,
    ...{
      baseURL
    }
  })
}

export function addComment(data) {
  return requestClue({
    url: '/goodsPc/addComment',
    method: 'post',
    data
  })
}

 

posted @ 2023-03-01 14:03  wjs0509  阅读(39)  评论(0编辑  收藏  举报