// childPackage/pages/electricQuery/components/listTable/index.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    list: {
      type: Array,
    },
    header: Array,
    totalPage: Number,
  },
  observers: {
    'list': function(val) {
      this.setData({
        tempList: (this.data.list || [])?.slice(0, 20),
        page: 1,
      })
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    page: 1,
    tempList: [],
  },
  lifetimes: {
    attached() {
      this.setData({
        tempList: (this.data.list || [])?.slice(0, 20),
      })
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    async onChangePage(e) {
      const page = e.detail.currentIndex;
      const that = this;
      this.setData({
        page,
        tempList: (this.data.list || [])?.slice((page - 1) * 20, page * 20)
      })
    },
  }
})