Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Q177】如何在 url 中传递数组 #178

Open
shfshanyue opened this issue Jan 14, 2020 · 1 comment
Open

【Q177】如何在 url 中传递数组 #178

shfshanyue opened this issue Jan 14, 2020 · 1 comment
Labels

Comments

@shfshanyue
Copy link
Owner

可以参考 arrays in query params

@shfshanyue shfshanyue added the js label Jan 14, 2020
@shfshanyue
Copy link
Owner Author

shfshanyue commented Dec 14, 2020

在 URL 中如何传递数组这种复杂的数据,完全取决于项目中前后端成员关于复杂数据在 URL 中传输的约定,一般情况下可以使用以下方式来传递数组

a=3&a=4&a=5

a=3,4,5

a[]=3&a[]=4&a[]=5

a[0]=3&a[1]=4&a[2]=5

但同样,需要后端开发者写一个 querystring.parse 来对指定的格式解析进行支持,同时也有对各种复杂 qs 支持较好的 package,比如:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant