我想修改'button-transparent:before'属性,具体取决于按钮是否具有wishlist类。下面的sass似乎不起作用
<button
className={classnames(
'button--transparent',
{'wishlist icon--heart-filled': props.wishlisted},
{'icon--heart': !props.wishlisted},
)}
onClick={props.toggle}
>
...
</button>
SASS
.button--transparent {
$color: initial;
.wishlist & {
$color: #EE4444;
}
&:before {
color: $color !important
}
}
答案 0 :(得分:1)
如果你想在dom元素有类 $stateProvider
.state('list',
{
url: "/",
template: '<list-directive></list-directive>'
})
.state('list.detail',
{
url: "/detail/{item_id}",
template: '<detail-directive></detail-directive>'
})
和:before
时应用.button--transparent
伪元素,那么sass应该如下所示:
.wishlist