我这里的是设置table的max-height高度随着浏览器的变化而变化:
<el-table ref="multipleTable" :data="PageData.data" tooltip-effect="dark" class="table_top" :max-height="$Config.tableHeight" v-loading="loading" border>
<el-table-column v-for="(item,index) in datas" :key="index" :show-overflow-tooltip="item=='goods_name'" :width="item==='goods_price'?'120px':''" :formatter="listtitle_inner" :label="item|capitalize" align="center" header-align="center">
<template slot-scope="scope">
。。。
</template>
</el-table-column>
</el-table>
最开始的时候:
var APP = this;
APP.$Config.tableHeight = APP.getTableHeight("table_top", 150);
window.onresize = () => {
APP.$Config.tableHeight = APP.getTableHeight("table_top", 150);
}
这时候值都是改变了,但是页面上的table的高度并没有随之而改变,这时候加上**APP.$forceUpdate();**就可以实现
APP.$forceUpdate();
有些时候通过v-for来循环出列表,但是想要改变某些值的时候,使用$set值是改变了,但是页面没有渲染,使用这个也是可以的