admin管理员组文章数量:1391929
I do the filtering, when I click on the apply filter, the query in the API flies away php-developer, says that the request should be get, not post how to pass parameters to the get query?
example for my post request
export const filterDate = (options) => {
console.log(options)
return axios.post(url, options).then(({ data }) => {
if (data.errors) throw new Error(JSON.stringify(data.errors));
return data;
})
};
but if I just replace the post on the get parameters are not transferred
I do the filtering, when I click on the apply filter, the query in the API flies away php-developer, says that the request should be get, not post how to pass parameters to the get query?
example for my post request
export const filterDate = (options) => {
console.log(options)
return axios.post(url, options).then(({ data }) => {
if (data.errors) throw new Error(JSON.stringify(data.errors));
return data;
})
};
but if I just replace the post on the get parameters are not transferred
Share Improve this question asked Apr 17, 2018 at 9:44 Kotov AleksandrKotov Aleksandr 331 silver badge3 bronze badges2 Answers
Reset to default 3If you want to pass parameters in get request, pass an object with "params" property, as follow:
axios.get('/user', {
params: {
ID: 12345
}
});
in options you specify a param object:
params: {
k: val
},
or by building an UrlSearchParam object:
const params = new URLSearchParams();
params.append('k', 'val');
axios.get(url, params);
本文标签: javascriptPassing parameters in get query to vue jsStack Overflow
版权声明:本文标题:javascript - Passing parameters in get query to vue js? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744677458a2619197.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论