【问题标题】:Whats the difference between /deep/ ::ng-deep?/deep/ ::ng-deep 有什么区别?
【发布时间】:2017-12-05 18:27:49
【问题描述】:

能否请您告诉我,以下两种 scss 样式之间的区别? 我对此没有明确的想法。

:host {
  display: inline-block;

  /deep/ {
    span {
      color: red;
    }
  }
}

:host {
  display: inline-block;

  ::ng-deep {
    span {
      color: red;
    }
  }
}

【问题讨论】:

  • 如果我可以在 中使用上述两种样式,是否会产生影响?

标签: css angular sass


【解决方案1】:

主要区别在于,SASS 支持 ::ng-deep,而删除了对 /deep/ 的支持。这就是为什么除了/deep/ 之外,Angular 还添加了::ng-deep

除此之外,两者都在 Angular 中被弃用,因为当所有浏览器中的原生 shadow DOM 支持变得可用时,它们可能会删除 ViewEncapsulation.Emulated

【讨论】:

    猜你喜欢
    • 2018-11-07
    • 2018-04-11
    • 2020-08-11
    • 1970-01-01
    • 2019-08-11
    • 2019-08-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多