报错[Vue warn]: You may have an infinite update loop in a component render function.

在开发中遇到这个问题,记录下。参照网上的方法解决:

源数据是经过sort()排序后的数据,正常操作却出现报错。 因为array.sort()改变了数组自身,导致了过滤器又一次被触发 。

报错[Vue warn]: You may have an infinite update loop

解决方法:

在排序前先用 slice()方法浅复制数组到一个新数组,并返回这个新数组

报错[Vue warn]: You may have an infinite update loop

加上这个就不会报错了。

相关文章:

  • 2021-12-26
  • 2021-07-24
  • 2021-07-23
  • 2021-04-04
  • 2021-08-29
  • 2021-06-12
猜你喜欢
  • 2021-06-01
  • 2022-12-23
  • 2021-06-08
  • 2021-12-12
  • 2021-09-11
  • 2022-12-23
  • 2021-12-15
相关资源
相似解决方案