我从这个函数中获取项目的 id,我想将这些 id 作为数组发送并使用 getAll() 检索它
const queryParams: Record<string, string[]> = selectedItems.reduce(
(acc, curr, index) => ({
...acc,
['item'] : curr.id
}),
{}
);
this.router.navigate(['/goToItems'], {
queryParams
});
我尝试了类似的方法,但没有得到数组。我想创建这样的东西:
this.router.navigate(['/goToItems'], {
item: [1, 2, 3, 4, 5] // this array should be queryParams
});
请你能与我分享如何实现这一点的任何想法吗?