element plus 想要覆盖组件的样式,想到了/deep/
样式穿透,但样式一直不生效,代码如下:
<style scoped lang="sass">
.main_wrapper{padding: 0 53pxposition: relativetop: -20px
}
>>> .el-tabs__item{height: 30pxline-height: 30pxcolor: #fff!important
}</style>
上边的写法不会报错,但是也不会生效。改用下面的方式:
<style scoped lang="sass">
.main_wrapper{padding: 0 53pxposition: relativetop: -20px
}
/deep/ .el-tabs__item{height: 30pxline-height: 30pxcolor: #fff!important
}
这样就报错了,SassError: expected selector
解决方法:
尝试用 ::v-deep
替换 /deep/ ,成功解决了问题。
<style scoped lang="sass">
.main_wrapper{padding: 0 53pxposition: relativetop: -20px
}
::v-deep(.el-tabs__item){height: 30pxline-height: 30pxcolor: #fff!important
}