【发布时间】:2018-10-29 17:14:06
【问题描述】:
有什么方法可以检查 mixins 中的参数。 例如,我有一个 shadow mixin,并且想以不同的方式包含它(调用它)以防它的参数。
@mixin 阴影($shadow, $position, $color) { ...... }
如果我通过 Top2 它应该只改变第一个参数
.box { @include shadow(inset, Top2, #000); } => `box-shadow: inset, 2px 0 0 0, #000`
如果我通过 Bottom2 它应该将参数更改为 -2px
.box { @include shadow(inset, Bottom2, #000); } => `box-shadow: inset, -2px 0 0 0, #000`
【问题讨论】:
-
我不这么认为,mixin 是一个可重用的 css 块 sass-lang.com/documentation/…
-
我不确定你到底想要什么?你能告诉我们你的 mixin 吗?