vue前端使用axios传参注意事项

axios只支持键值对传参,如果只有一个数据也要封装为键值对,ids为后台接收的参数
例如const data = { ids: JSON.stringify(parameter) }

1.如果后台接收的数据类型为数组类型,则,前台组装数据为1,2,2,4,3
注意不要加()和[],否则出错
2.如果传递集合形式: ids=[1,18,19,20,21,22,23,24,25,26]
报错,The valid characters are defined in RFC 7230 and RFC 3986
这里使用post方式也会报错,需要转义或者降低Tomcat版本

原文地址:https://www.cnblogs.com/InternetJava/p/14350231.html