【发布时间】:2021-02-15 03:42:28
【问题描述】:
我需要改变:before style by condition 我尝试使用https://stackoverflow.com/a/37902154/13739803 解决方案但不起作用 我的代码是:
.sender:before {
content: "";
width: 0px;
height: 0px;
position: absolute;
border-left: 15px solid $otaghakPinkLight;
border-right: 15px solid transparent;
border-top: 15px solid $otaghakPinkLight;
border-bottom: 15px solid transparent;
right: -16px;
top: 0px;
visibility: var(--porcentaje-visibility);
}
html代码:
<div class="message-box sender" [style]="{ '--porcentaje-visibility': showAvatar ? 'visible' : 'hidden' }">test</div>
我想显示或隐藏 :before 按条件
【问题讨论】: