jeecg框架修改默认的白色背景
- 原背景
![原背景](https://img-blog.csdnimg.cn/575609c09b4b4daf84964f831a183cec.png#pic_center)
- 一个组件解决更换背景色
<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>
- 使用此组件
![在这里插入图片描述](https://img-blog.csdnimg.cn/816b2bb189b6437e84716cbb118e3751.png)
- 最终效果
![在这里插入图片描述](https://img-blog.csdnimg.cn/6c5823cad62d45d8b4b94a12df729d6e.png)