2020-02-24 angular component装饰器

2020-02-24  本文已影响0人  rub1cky
 @Component({ 
  changeDetection?: ChangeDetectionStrategy
  viewProviders?: Provider[]
  moduleId?: string
  templateUrl?: string
  template?: string
  styleUrls?: string[]
  styles?: string[]
  animations?: any[]
  encapsulation?: ViewEncapsulation
  interpolation?: [string, string]
  entryComponents?: Array<Type<any>|any[]>
  preserveWhitespaces?: boolean
  // inherited from core/Directive
  selector?: string
  inputs?: string[]
  outputs?: string[]
  host?: {[key: string]: string}
  providers?: Provider[]
  exportAs?: string
  queries?: {[key: string]: any}
})

ViewEncapsulation

enum ViewEncapsulation {
  Emulated: 0
  Native: 1
  None: 2
}

ViewEncapsulation.None - 不但没有使用shadow DOM的方式封装模板和样式,并且什么封装方式也没有使用。
ViewEncapsulation.Emulated - 没有使用shadow DOM的封装方式,但是使用了一个内置的模拟器来进行封装。
ViewEncapsulation.Native - 使用了原生的shadow DOM方式来进行封装。

主要告诉客户端以什么方式运行

上一篇 下一篇

猜你喜欢

热点阅读