var Enumerable = require('linq'); // 使用linq

按照RegisterID排序
listJust是自己定义的数组,来接收数据。
listJust: []

addData(data) {
                let that = this
                if (this.listJust.length && this.listJust.length >= 5) {
                    // 数据超过5条后,继续增加数据的时候,将最早的数据清除
                    this.listJust.splice(this.listJust.length - 1, 1)
                    this.listJust.push(data);
                    this.listJust = Enumerable.from(this.listJust).orderByDescending("d=>d.RegisterID").toArray();
                } else {
                    this.listJust.push(data);
                    this.listJust = Enumerable.from(this.listJust).orderByDescending("d=>d.RegisterID").toArray();
                }
            },

 

相关文章:

  • 2021-11-25
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2021-07-07
  • 2021-09-14
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2022-02-01
  • 2022-02-28
  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案