Loading

Vue—样式穿透/deep/ >>> ::v-deep deep()四者的区别

Vue—样式穿透/deep/ >>> ::v-deep deep()四者的区别

1./deep/

在vue3.0之前可使用,例如(复写样式前加/deep/),vue3.0及后使用就会报错

& /deep/ .el-input {
    width: 60px;
}

2. ::v-deep

在vue3.0及后使用,替代/deep/

&::v-deep .el-input {
    width: 60px;
}

3. >>>

只作用于css,对于less和scss不起作用,如果是less和scss的话需要用到/deep/或::v-deep

4. deep()

使用场景尚需补充

&:deep(.el-input) {
    width: 60px;
}
posted @ 2021-12-06 11:36  顾诚的城  阅读(1700)  评论(1编辑  收藏  举报