Commit 85a8d99c authored by leon's avatar leon

feat: table calculate height

parent ab87837d
......@@ -80,7 +80,7 @@
backgroundColor: headerBackgroundColor,
titlePostion: headerTitlePostion,
titleFontSize: headerTitleFontSize
} = this.elementInfo.table.tableHeader
} = this.elementInfo.table.tableHeader
const cellWidth = this.elementInfo.table.column.length > 10 ? 130 : 240
return {
'--table-width': `${cellWidth * this.elementInfo.table.column.length}rpx`,
......@@ -128,8 +128,31 @@
})
that.elementInfo.table.column = columns
}
that.chartTables = that.elementData.dataList.chartTables
that.chartTables = that.elementData.dataList.chartTables
// if(that.elementInfo.table.tableCell.autoHeight) {
that.calculateCellHeight()
// }
})
},
calculateCellHeight() {
var query = wx.createSelectorQuery().in(this);
query.select(".normal-table").boundingClientRect(res => {
const height = res.height
// 计算table的高度
var {
cellRowHeight,
} = this.elementInfo.table.tableCell
const {
headerRowHeight,
} = this.elementInfo.table.tableHeader
const padding = 20
const tableHeight = padding + parseInt(headerRowHeight) + (padding + parseInt(cellRowHeight)) * this.chartTables.length
if(height - tableHeight - padding > this.chartTables.length) {
cellRowHeight = (height - padding - parseInt(headerRowHeight) - padding - padding * this.chartTables.length) / this.chartTables.length
this.elementInfo.table.tableCell.cellRowHeight = cellRowHeight
}
}).exec();
},
tableCellStyle(column, index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment