diff --git a/src/App.vue b/src/App.vue index 6f9e8d55e..0f854550a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -92,7 +92,32 @@ export default { isBoolean: false } }, + created() { + let _this = this; + //窗口改变时 + window.onresize = function () { + _this.handleRefreshTable(); + }; + }, + updated() { + this.handleRefreshTable() + }, methods: { + handleRefreshTable() { + this.$nextTick(() => { + // 获取页面中已注册过ref的所有的子组件。 + let refList = this.$refs.appView.$refs; + if (refList) { + for (let i of Object.keys(refList)) { + // 根据doLayout方法判断子组件是不是el-table + if (refList[i] && refList[i].doLayout) { + // 执行doLayout方法 + refList[i].doLayout(); + } + } + } + }) + }, // 点击下拉选项事件 handleCommand(command) { // 退出登录 @@ -227,6 +252,8 @@ export default { } else { this.isBoolean = false } + //切换标签时 + this.handleRefreshTable(); } }, mounted() {