当将类结合到MAT-CARD时,MAT-CARD类不结合

发布于 2025-02-07 09:28:25 字数 371 浏览 1 评论 0 原文

当将单个类结合到MAT卡上时,MAT卡类不结合。

<mat-card cdkDropList [className]="getClassName(item)"><!-- some content--></mat-card>

在这种情况下,我们将无法将类名称视为垫子卡,也不会从材料中使用样式。

when apply single class binding to mat-card, mat-card class is not binding.

<mat-card cdkDropList [className]="getClassName(item)"><!-- some content--></mat-card>

In this case we wont be able to see class name as mat-card and no style been applied from material.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

別甾虛僞 2025-02-14 09:28:25

只需使用标准 [class] 绑定,例如

<mat-card cdkDropList [class]="getClassName(item)">
  <!-- some content-->
</mat-card>

基于docs

Just use the standard [class] binding, e.g.

<mat-card cdkDropList [class]="getClassName(item)">
  <!-- some content-->
</mat-card>

Example based on forked example from docs here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文