Best Way to Pass Query Parameters to URL Using Axios in Vue?

You can use the second argument to .get if you want to pass an object instead:

axios.get(this.jobsListURL, {
  params: this.axiosParams
})

This is pretty much the same, but you don’t have to do the string manipulation for the URL.

You can build that object like this:

computed: {
    axiosParams() {
        const params = new URLSearchParams();
        params.append('param1', 'value1');
        params.append('param2', 'value2');
        return params;
    }
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)