提交 807d3703 authored 作者: junjie's avatar junjie

feat(视图):视图 表格 组件样式,高度自适应

上级 e6e651e1
...@@ -95,8 +95,14 @@ export default { ...@@ -95,8 +95,14 @@ export default {
methods: { methods: {
init() { init() {
const that = this const that = this
this.fields = JSON.parse(JSON.stringify(this.chart.data.fields)) let datas = []
const datas = JSON.parse(JSON.stringify(this.chart.data.tableRow)) if (this.chart.data) {
this.fields = JSON.parse(JSON.stringify(this.chart.data.fields))
datas = JSON.parse(JSON.stringify(this.chart.data.tableRow))
} else {
this.fields = []
datas = []
}
this.$refs.plxTable.reloadData(datas) this.$refs.plxTable.reloadData(datas)
this.initStyle() this.initStyle()
window.onresize = function() { window.onresize = function() {
...@@ -108,7 +114,12 @@ export default { ...@@ -108,7 +114,12 @@ export default {
setTimeout(function() { setTimeout(function() {
const currentHeight = document.documentElement.clientHeight const currentHeight = document.documentElement.clientHeight
const tableMaxHeight = currentHeight - 56 - 40 - 84 - that.$refs.title.offsetHeight - 8 * 2 - 20 const tableMaxHeight = currentHeight - 56 - 40 - 84 - that.$refs.title.offsetHeight - 8 * 2 - 20
const tableHeight = (that.chart.data.tableRow.length + 2) * 36 let tableHeight
if (that.chart.data) {
tableHeight = (that.chart.data.tableRow.length + 2) * 36
} else {
tableHeight = 0
}
if (tableHeight > tableMaxHeight) { if (tableHeight > tableMaxHeight) {
that.height = tableMaxHeight + 'px' that.height = tableMaxHeight + 'px'
} else { } else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论