How to pass two parameters to the background when vue.js initiates a get request.

 let tiaojian = this.$route.params.id
        fetch("searchread/"+tiaojian, null,"get",(data)=>{
            for(var i in data){
                this.reads.push(data[i])
            }
        })
    

this is an encapsulated get request. I want to pass two or more parameters.

my question is too unclear. Excuse me, everyone, but we use the node express framework to build the background, app.get ("/".) Such

Dec.15,2021

multiple parameters are merged into one object


is this restful api? Ask backstage how he interprets it.


there are two ways: one is your writing, with multiple parameters separated by a slash (the type of route that may be defined by this backend is / < int:id1 > / < int:id2 >); the other is to add the form of params1=xxx&?params2=xxx after the route (the python backend needs to be obtained according to the request.args). It mainly depends on the form of the back-end interface.


pass parameters together in the format of an object


fetch('searchread/'+tiaojian, {
    method: 'get',
    headers: {
        'credentials': 'include',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        sth: {},
        sth2: [],
        // ...
        // 
    })
}).then(result => result.json()).then((data) => {
    for(var i in data){
        this.reads.push(data[i])
    }
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea51b0-1d2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea51b0-1d2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?