jeecg框架修改默认的白色背景
- 原背景

- 一个组件解决更换背景色
<template>
<div class="main-warp">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'GreyBackground',
data() {
return {}
},
computed: {},
watch: {},
beforeDestroy() {
this.getLayoutContent().classList.remove('common-grey')
},
mounted() {
this.setBackground()
},
methods: {
getLayoutContent() {
return document.querySelector('.layout-content')
},
setBackground() {
this.getLayoutContent().classList.add('common-grey')
}
}
}
</script>
<style lang="less">
.common-grey {
background-color: #f0f2f5 !important;
padding: 0 !important;
}
</style>
<style lang="less" scoped>
.main-warp {
width: 100%;
height: 100%;
}
</style>
- 使用此组件

- 最终效果
