可以使用axios提供的config参数,在配置中传递params的对象,作为get请求的参数。例如:
axios.get('/api/data', {
params: {
id: 123,
name: 'John'
}
})
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
})
这样,客户端的参数将被正确传递到服务器端,并可以在服务器端进行使用。