我不会根据父方向创建不同风格的组件。
例如:
<!-- some tags with dir attribute -->
<my-component></my-component>
<!--close some tags with dir attribute -->
与支持chrome的:dir(ltr)
相当的东西?
更新:这是工作,但是我如何在另一种风格中使用它?
[dir='rtl'] mat-header-cell {
border-left: dashed;
}
[dir='ltr'] mat-header-cell {
border-right: dashed;
}
发布于 2019-04-05 07:52:40
如果您试图从组件中调整:host-context
选择器,则可以使用它:
@Component({
template: `
<div class="with-border">Lorem</div>
`,
selector: 'my-component',
styles: [`
:host-context([dir='rtl']) .with-border {
border-left: dashed;
}
:host-context([dir='rtl']) .with-border {
border-right: dashed;
}
`]
})
export class MyComponent {}
https://stackoverflow.com/questions/55530203
复制相似问题