继上篇的让表格高度跟随全屏变化
这回让表格高度跟随着折叠面板的开与关
下面是iview的折叠开关代码
<CellGroup>
<Collapse simple v-model="collapseVal">
<Panel name="1">
</Panel>
</Collapse>
</CellGroup>
下面是iview的监听折叠的开关变化来改变高度
export default {
name: '',
components: {},
data() {
return {
collapseVal: '1'
}
},
watch: {
collapseVal(newVal, oldVal) { // 如果画板折叠,返回空数组,反之返回只有一个元素的数组
// console.log('折叠旧值', oldVal)
// console.log('折叠新值', newVal)
newVal.length > 0 ? (this.table_height = parseInt(this.table_height)- 100) : (this.table_height = parseInt(this.table_height)+ 100)
console.log('新的高度', JSON.parse(JSON.stringify(this.table_height)))
}
},