实现 next js 可选捕获所有路由而不删除index.js

7 javascript routes reactjs next.js vercel

如何实现 Next js 功能捕获所有路由 [[...slug.tsx]] ( https://nextjs.org/docs/routing/dynamic-routes#optical-catch-all-routes ) 而不删除索引。 js页面?如果我不删除它,我会收到此错误:

Error: You cannot define a route with the same specificity as a optional catch-all route ("/" and "/[[...slug]]").
Run Code Online (Sandbox Code Playgroud)

我读到一条建议,将其更改为非可选捕获所有路线([...slug.tsx])..但这不允许我捕获没有 slug 的路线(即/post)