|  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import router from "@/router"; | 
|---|
|  |  |  | import {mapState} from "vuex"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'BaseComputeHeight', | 
|---|
|  |  |  | name: 'BaseComputeHeightDefault', | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | tableHeightNew: 300 | 
|---|
|  |  |  | // tableHeightNew: 300 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | computed: { | 
|---|
|  |  |  | ...mapState(['tableHeightNew']) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | created() { | 
|---|
|  |  |  | this.computeTableHeight() | 
|---|
|  |  |  | // console.log('created' ,this.tableHeightNew) | 
|---|
|  |  |  | // this.computeTableHeight() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | mounted () { | 
|---|
|  |  |  | this.computeTableHeight() | 
|---|
|  |  |  | window.addEventListener('resize', this.computeTableHeight) | 
|---|
|  |  |  | // this.computeTableHeight() | 
|---|
|  |  |  | // console.log('mounted' ,this.tableHeightNew) | 
|---|
|  |  |  | // window.addEventListener('resize', this.computeTableHeight) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | activated() { | 
|---|
|  |  |  | this.computeTableHeight() | 
|---|
|  |  |  | // console.log('activated' ,this.tableHeightNew) | 
|---|
|  |  |  | // this.computeTableHeight() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | computeTableHeight () { | 
|---|
|  |  |  | 
|---|
|  |  |  | let height2 = document.getElementsByClassName('toolbar') && document.getElementsByClassName('toolbar')[0]?document.getElementsByClassName('toolbar')[0].clientHeight:0 | 
|---|
|  |  |  | let height5 = document.getElementsByTagName('thead') && document.getElementsByTagName('thead')[0]? document.getElementsByTagName('thead')[0].clientHeight:0 | 
|---|
|  |  |  | // this.tableHeightNew = height-height4-height3-height2-height1-height5-height6-height7-height8-height9 -height10// 打印高度 | 
|---|
|  |  |  | this.tableHeightNew = height-height4-height3-height2-height1-height5 -height6 | 
|---|
|  |  |  | // this.tableHeightNew = height-height4-height3-height2-height1-height5 -height6 | 
|---|
|  |  |  | console.log('defualt',height,height6,height3 ,height1,height2,height4,height4) | 
|---|
|  |  |  | console.log('defualt',this.tableHeightNew) | 
|---|
|  |  |  | console.log('defualtlength',document.getElementsByClassName('table-search-form').length) | 
|---|
|  |  |  | router.app.$store.commit('setTableHeightNew', height-height4-height3-height2-height1-height5 -height6) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|