开发者社区 问答 正文

sass嵌套,.child{.parent & { }} 无效?

<span ng-class="{'group-expand': isExpand}">
    <i class="icon-arrow-right"></i>
</span>
@mixin rotate($deg) {
  -webkit-transform: rotate($deg);
  -moz-transform: rotate($deg);
  -ms-transform: rotate($deg);
  -o-transform: rotate($deg);
  transform: rotate($deg);
}

//solution1
.icon-arrow-right {
    @include rotate(0deg);
    .expand & {
        @include rotate(90deg);
    }
}

//solution2
.icon-arrow-right {
    @include rotate(0deg);
}
.expand .icon-arrow-right {
    @include rotate(90deg);
}

请问为何 solution1 无效呢?

展开
收起
杨冬芳 2016-06-08 17:31:47 1929 分享 版权
1 条回答
写回答
取消 提交回答
  • IT从业

    复制你的代码 编译成功
    是你scss是版本问题吧

    2019-07-17 19:32:26
    赞同 展开评论
问答地址: