我想用查询参数中的重复键构造一个像“ http://localhost:64549/request/list?page=1&dataLakeStatus=1&dataLakeStatus=2”这样的url字符串。由于JS不允许重复的密钥,我该如何用Vue路由器执行此操作?



 private redirectToFirstPage() {
    const query = { page: this.currentPage.toString(), dataLakeStatus: '1', dataLakeStatus: '2' };
    this.$router.push({ query });
  }

最佳答案

请尝试以下操作:

private redirectToFirstPage() {
    const query = {
        page: this.currentPage.toString(),
        dataLakeStatus: [1, 2]
    };

    this.$router.push({ query });
}

10-07 21:22