繁体   English   中英

NextJS next-routes:如何为同一个键设置多个值?

[英]NextJS next-routes: How to have multiple values for same key?

我想知道如何使用 nextjs 路由为同一个键设置多个值,例如:

这就是我现在所拥有的:

http://example.com/page?colors=white?numbers=1 query.colors 将是一个字符串“white”

这就是我想要的:

http://example.com/page?colors=white-red-blue?numbers=1-2-3我想 query.colors 是一个包含 ["white", "red","blue" 这样的字符串的数组]

ps:我用的是https://github.com/fridays/next-routes

编辑:找到这个https://github.com/fridays/next-routes/issues/250

只用一个? 拆分成查询参数。 然后你可以使用&来显示多个值。 之后,您将有几个选项可以选择如何在 url 中显示 arrays

.../page?colors=white&numbers=1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM