因此,当我使用 Router.push 时,我用它发送的查询会被覆盖
Router.push({
pathname: `/product/${subCategoryValue}`,
query: { category: helpWith, industry: industry },
});
当我在
console.log(query)
页面上 /product/${subCategoryValue}
时,唯一显示的是 url 参数(subCategoryValue)。
使用下面的代码修复了它:
Router.push(
{
pathname: `/product/${subCategoryValue}`,
query: { category: helpWith, industry: industryValue },
},
`/product/${subCategoryValue}`
);