我想创建一个以下划线开头的 URL 地址,但我不能,因为 next.js dacument 说它是一个私有(private)文件夹!
我该怎么做?
示例:/shop/_t-shirt
最佳答案
在版本 13 中,Next.js 提到了一种可以创建以下划线开头的 URL 段的方法
https://nextjs.org/docs/app/building-your-application/routing/colocation
You can create URL segments that start with an underscore by prefixing the folder name with %5F (the URL-encoded form of an underscore): %5FfolderName.
这样你就可以做到:
/app
/shop
/%5Ft-shirt
page.tsx
关于javascript - 如何在接下来的 13 中创建带有下划线的路线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76804228/