我想通过以下方式从查询参数创建一个 url:
router.push(
{
pathname: '/cars',
query: colors + type + price,
},
undefined,
{
shallow: true,
},
);Run Code Online (Sandbox Code Playgroud)
const colors = ['red', 'blue', 'yellow']; //the arrays could contain many others values
const type = ['offroad', 'sport'];
const price = 'hight' //this is a stringRun Code Online (Sandbox Code Playgroud)
我想实现,当我单击触发的按钮时router.push,下一个:
/cars?color=red,yellow,blue&type=offroad,sport&price=hight