解决AxiosError: options must be an object ERR_BAD_OPTION_VALUE

Error message:

{message: 'options must be an object', name: 'AxiosError', code: 'ERR_BAD_OPTION_VALUE', stack: 'AxiosError: options must be an object\n at Objec…ji.com/static/js/chunk-libs.c096185b.js:42:41367)'}

The reason for the production error is:

Due to the upgrade of axios version, 0.x is upgraded to 1.x, which occurs when the request parameter array is serialized

solve:

  export function delRoleMany (params) {
    return request({
      url:`/api/app/tenant-role/many`,
      method: 'delete',
      params: params,
      // paramsSerializer: function(params) {
      //   const keys = params.ids.map(item=>`ids=${item}`).join('&')
      //   return `${keys}`
      // }
      paramsSerializer:{
        serialize:function(params){
          const keys = params.ids.map(item=>`ids=${item}`).join('&')
          return `${keys}`
        }
      }
    })
  }

 Data required by the interface:

 The params passed in the foreground:

 

Guess you like

Origin blog.csdn.net/qq_46617584/article/details/129871433