【发布时间】:2021-10-16 08:09:07
【问题描述】:
当我导航到我的 nextjs 应用程序的 http://localhost:3000/users/123?foo=bar
当我打印出router.query
{id: "123"}
没有将foo: 'bar' 添加到查询对象的原因可能是什么?
【问题讨论】:
-
一般是你的路由路径定义的,能不能也放在这里?
标签: next.js nextjs-dynamic-routing
当我导航到我的 nextjs 应用程序的 http://localhost:3000/users/123?foo=bar
当我打印出router.query
{id: "123"}
没有将foo: 'bar' 添加到查询对象的原因可能是什么?
【问题讨论】:
标签: next.js nextjs-dynamic-routing
【讨论】:
我必须添加一个带有以下内容的 next.config.js 文件
module.exports = {
reactStrictMode: true,
async rewrites() {
return [
{
source: '/pages/:slug*',
destination: '/:slug*'
}
]
}
}
【讨论】: