Open
Description
ngStyle
添加变量到ngStyle中
pWidth = '100'
<p [ngStyle]="{'width.px': pWidth}"></p>
根据变量添加不同属性
showP = false
<p [ngStyle]="{'display': showP ? 'block': 'none'}"></p>
花式添加style
ts中直接在组件顶层dom添加style
@Component({
selector : 'p-sample',
host : {
'[style.color]' : `'red'`
}
})
html中添加style
<p [style.color]="'red'"></p>
Metadata
Metadata
Assignees
Labels
No labels