轻松混合功能,根据类别改变mixin

时间:2016-06-16 09:27:44

标签: less

我是LESS的新手,我想知道什么是动态混音的最佳解决方案。我想要做的是根据父包装器更改边框颜色。 例如.letterList& .letterActive位于.azStores包装类中。这里我的mixin设置为@azStoresMainColor。 在我的html中,包装器类是动态更改的(categoryStores,floorStores ...),我想根据那些wrapperClass更改边框的颜色。

在LESS有一个很好的解决方案吗?非常感谢。

.grouplistBorderMixin() {
    border-top: 2px solid @azStoresMainColor;
}

.letterList div:nth-child(1) {
    .grouplistBorderMixin;
    box-sizing: border-box;
} 

.letterActive {
    text-align: center;
    height: 94px;
    line-height: 94px;
    .grouplistBorderMixin;
    box-sizing: border-box;
}

0 个答案:

没有答案