When mocking data, view the data transmitted from the front end through the simulation interface.

When calling the mock simulation interface, you want to view the data passed when calling the interface, but using console.log and debugger on the mock interface is invalid (my personal understanding is because mock is a back-end content, which is equivalent to being beyond the control of the front-end code) backend code?). At this time, you can use return to return the passed data to view the data format and content. This method may be silly but it solved my problem.

Project framework vben admin vue3 vite

Directly view the passed parameters

  {
    
    
    url: '/basic-api/find',
    timeout: 100,
    method: 'post',
    response: ({
     
      body }) => {
    
     // body里面一般就是调用接口时传过来的参数
      return body ;
    },
  },

view more

  {
    
    
    url: '/basic-api/find',
    timeout: 100,
    method: 'post',
    response: (params) => {
    
     // params里面包含更多内容
      return params;
    },
  },

The contents of params are as follows:

body: {
    
    }
headers: {
    
    ...}
query: {
    
    }
url: "/basic-api/find"

Guess you like

Origin blog.csdn.net/Heixiu6/article/details/127555911