Mockjs wraps the data I want with another layer.

for example, the return I want is

{
  a: 1
}

the data returned after using mockjs is

{
  config: ...,
  data: {
    a: 1
  },
  headers: ...,
  status: ...
}

what I can make mockjs direct against me is the format I configured, not another layer of data I need.

=

update question: axios has a layer of package, how to get rid of it.

=


you should use axios

.

axios automatically gives the returned packet a layer


the outer layer of your bread is not wrapped by mockjs , is it

Menu