export const pageMargin = 20 + 20
export default {
data() {
return {
tableHeight: null
}
},
activated() {
if (!this.$root.isQiankun) {
this.resizeTableHeight()
}
},
mounted() {
if (!this.$root.isQiankun) {
this.resizeTableHeight()
}
},
methods: {
resizeTableHeight() {
this.setTableHeight()
const elementResizeDetectorMaker = require('element-resize-detector')
const listener = elementResizeDetectorMaker()
const appWrapper = document.querySelector('.app-main')
listener.listenTo(appWrapper, element => {
this.setTableHeight()
})
this.$on('hook:beforeDestroy', () => {
listener.uninstall(appWrapper)
})
},
setTableHeight() {
this.$nextTick(() => {
const appMain = document.querySelector('.app-main')
if (!this.$refs['tableTitle']) {
return
}
const wrapHeight = appMain.offsetHeight
const searchBoxHeight = document.querySelector('.search-form')
? document.querySelector('.search-form').offsetHeight
: 0
const headerHeight = this.$refs['tableTitle'].$el.offsetHeight
const pageBarHeight = this.$refs['page-bar'] ? this.$refs['page-bar'].$el.offsetHeight : -20
this.tableHeight =
wrapHeight -
headerHeight -
searchBoxHeight -
pageBarHeight -
pageMargin
this.layoutTable()
})
}
}
}