element ui 弹窗样式居中 (弹窗里面的图片做等比自适应展示)







// store/modules/pageHight.js
export default {
    state: {
        contentBoxHeight: (window.innerHeight - 80), // 动态计算右侧内容总高度
    },
    mutations: {
        setContentBoxHeight(state, pageHight) {
            state.contentBoxHeight = pageHight;
        }
    },
  }
// home文件全局处理下右边的布局高度 右侧最外层div 给上 ref 
mounted() {
    window.addEventListener('resize', () => {
        if (this.$refs.rightBox && this.$refs.rightBox.clientHeight) {
            this.setContentBoxHeight(this.$refs.rightBox.clientHeight)
        }
    })
    if (this.$refs.rightBox.clientHeight) {
        this.setContentBoxHeight(this.$refs.rightBox.clientHeight);
    }
},
methods: {
    ...mapMutations({
        "setContentBoxHeight": "setContentBoxHeight"
    }),
}