如果你希望scoped样式中的一个选择器能够作用的更深,可以使用>>>操作符
<style scoped>
.json-editor{
height: 100%;
position: relative;
}
.json-editor >>> .CodeMirror {
height: auto;
min-height: 300px;
}
.json-editor >>> .CodeMirror-scroll{
min-height: 300px;
}
.json-editor >>> .cm-s-rubyblue span.cm-string {
color: #F08047;
}
</style>
但是想Sass之类的预处理器无法正确解析>>>,这种情况你可以使用/deep/或 ::v-deep操作符取而带之,两者都是>>>的别名,同样可以正常操作,一般我们把这种情况运用在更改elelmentui组件自带的样式时使用
.showRequired {
/deep/ .el-form-item__label::before {
content: '*';
color: #e63232;
margin-right: 4px;
}
}
.hiddenRequired {
/deep/ .el-form-item__label::before {
content: '' !important;
color: #e63232;
margin-right: 4px;
}
}