首页 > 解决方案 > CSS在浏览器背面扭曲

问题描述

我有一个使用带有多个组件的 TS 的角度应用程序。每个组件都有自己的 CSS,没有封装。

@Component({  
  selector: 'app-comp1',  
  templateUrl: './component1.html',  
  styleUrls: ['./component1.css'],  
  encapsulation: ViewEncapsulation.None  
})

这里的问题是,如果用户将浏览器从组件 2 击回组件 1,则生成的 html 包含两个组件的 css,从而扭曲了组件 1。

我如何保持浏览器上的 css 干净。

标签: angulartypescript

解决方案


推荐阅读