开始做工作台,调整用电查询分页

This commit is contained in:
2024-11-08 18:24:05 +08:00
parent 08ef87ce33
commit b9d1ee34a7
32 changed files with 384 additions and 16 deletions

View File

@@ -0,0 +1,53 @@
// childPackage/pages/electricQuery/components/listTable/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
list: {
type: Array,
watch(newVal) {
console.log("newVal ------", newVal)
}
},
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() {
console.log('this.data', this.data.list)
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)
})
},
}
})

View File

@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"table": "/components/table/table",
"empty": "/components/empty/index",
"pagination": "/components/pagination/index"
}
}

View File

@@ -0,0 +1,11 @@
<!--childPackage/pages/electricQuery/components/listTable/index.wxml-->
<view wx:if="{{list.length}}">
<table header="{{header}}" list="{{tempList}}" />
<pagination
currentIndex="{{page}}"
totalPage="{{totalPage}}"
bind:pagingChange="onChangePage"
/>
</view>
<empty bind:refresh="init" wx:else />

View File

@@ -0,0 +1 @@
/* childPackage/pages/electricQuery/components/listTable/index.wxss */