我在我的项目中使用 nextjs 的默认动态路由技术,它基于文件夹结构。我有一条路线是:
pages/[language]/location/[location_id]
现在我遇到了一个用例,除了最后一个参数[location_id]
, 我需要[route_id]
这里之外,我需要与上述路由完全相同。
当我[route_id].js
为这条新路线创建文件时,我遇到了这个错误:
throw new Error(`You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`);
我知道这个错误以及为什么在做了一些研究后向我显示这个问题,但我无法理解如何解决这个问题。我只想要一个解决方案,如何在我的应用程序中实现这两条路线:
Route 1: pages/[language]/location/[location_id]
Route 2: pages/[language]/location/[route_id]
PS:我已经研究过这个:https : //github.com/zeit/next.js/issues/9081