When axios interacts with the backend, the parameters need to be written in body and query.

clipboard.png

this is the parameter required by the backend.

if the parameters are all written in body, I will write this.

if the parameters are all written in query, I will write this.

The

parameter is written in both body and query.

I tried. No.

this.$axios.get("/back/content/list",{
    params:{
        pageNo:this.page_current, //
        pageSize:this.page_number, //
    }
},
{
    author:"",
    title:"",
    channelId:"",
    status:"",
    isFreeType:"",
    audit:""
})
.then(res=>{
    if(res.meta.code == 200){
        this.loading = false;
        this.tableData = res.data.dataList.list; //list
        this.allTotal = res.data.dataList.total; //
    }
})

The parameters of

query you can actually make variable concatenation on top of the request path.
it's even more beautiful if you use fetch, and it would be nice to use the object properties of data and params.


1. Your interface is post , right? Are you sure you read the interface document correctly?
2. get cannot put request parameters into please body body.

this.$axios.get('/back/content/list',{
    params:{
        pageNo:this.page_current, //
        pageSize:this.page_number, //
    }
},

3. get the actual request is / back/content/list?pageNo=1&pageSize=1

4. If you want to implement the description of your backend, you can only

this.$axios.post('/back/content/list?pageNo=1&pageSize=1'//query,
{
       status:true,//body(params)   
}),

axios.get('/api/xxx',{
    params: {
        // query
    }
})
axios.post('/api/xxx',{
// post body
},{
    params: {
        // query
    }
})
Menu