【发布时间】:2021-03-26 16:30:09
【问题描述】:
我有一个类似的网址
bar?id=foo
如果我通过router.push('bar?id=foo') 路由到这里,一切正常。
但是如果我在浏览器中直接进入路由,查询字符串不会通过。
const BarComponent = ()=>{
console.log(useRouter())
}
这个输出
ServerRouter {
route: '/bar',
pathname: '/bar',
query: {},
asPath: '/bar',
basePath: '',
events: undefined,
isFallback: false,
locale: undefined,
isReady: false,
locales: undefined,
defaultLocale: undefined,
domainLocales: undefined,
isPreview: false,
isLocaleDomain: false
}
【问题讨论】:
标签: javascript next.js next-router