sass 中使用 /deep/ 修改 elementUI 组件样式报错的解决方案
作者:程序员iteng
这篇文章主要介绍了sass 中使用 /deep/ 修改 elementUI 组件样式报错的解决方案,尝试用 ::v-deep 替换 /deep/ ,成功解决了问题,感兴趣的朋友跟随小编一起看看吧
element plus 想要覆盖组件的样式,想到了/deep/样式穿透,但样式一直不生效,代码如下:
<style scoped lang="sass">
.main_wrapper{
padding: 0 53px
position: relative
top: -20px
}
>>> .el-tabs__item{
height: 30px
line-height: 30px
color: #fff!important
}
</style>上边的写法不会报错,但是也不会生效。改用下面的方式:
<style scoped lang="sass">
.main_wrapper{
padding: 0 53px
position: relative
top: -20px
}
/deep/ .el-tabs__item{
height: 30px
line-height: 30px
color: #fff!important
}这样就报错了,SassError: expected selector
解决方法:
尝试用 ::v-deep 替换 /deep/ ,成功解决了问题。
<style scoped lang="sass">
.main_wrapper{
padding: 0 53px
position: relative
top: -20px
}
::v-deep(.el-tabs__item){
height: 30px
line-height: 30px
color: #fff!important
}到此这篇关于sass 中使用 /deep/ 修改 elementUI 组件样式报错的文章就介绍到这了,更多相关sass 使用 /deep/ 报错内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
