代码之家  ›  专栏  ›  技术社区  ›  AmerllicA

Uncaught TypeError:(中间值)。concat不是函数

  •  3
  • AmerllicA  · 技术社区  · 6 年前

    我正在研制一种 react Material UI 对于分页,我应该通过 rowsPerPageOptions 作为具有数组值的道具,但是我希望这个数组没有重复项,所以我决定创建一个 Set 然后把它转换成一个数组,所以我写了下面的代码:

    <TablePagination
      ~~~
      rowsPerPageOptions={[...new Set([1, 2, 3, 4, 4, 5, 5])]}
      ~~~
    />
    

    Uncaught TypeError: (intermediate value).concat is not a function
    

    当我使用 Array.from 一切都很好,但为什么要传播运算符 ES6 不起作用?

    enter image description here

    0 回复  |  直到 4 年前