Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
562 views
in Technique[技术] by (71.8m points)

vue-cli3 使用深度选择器自定义修改element-ui样式失败

我引用了element的

想调整弹出头的样式,在浏览器调试时可用直接通过修改.el-collapse-item__header来修改样式。

但是在我的vue中,即使我用了深度选择器也无效。

    .el-collapse-item >>> .el-collapse-item__header{
        background-color: rgb(217, 237, 247);
    }

又或者我自己给父组件增加了一个myBG的类,然后深度选择器选择,依旧无效:
image.png

        .myBG >>> .el-collapse-item__header{
            background-color: rgb(217, 237, 247) !important;
        }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你写的是 sass 还是 css?
如果是sass,需要换用 /deep/

.myBG {
  /deep/  .el-collapse-item__header{
    background-color: rgb(217, 237, 247) !important;
  }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...