我正在为LESS中的颜色循环工作。问题是我的@joined参数。我想要选择'&'给这个类,但是我得到一个语法错误。我怎么能设置这个?减少无法识别的参数
SyntaxError: could not understand value for named argument
.coloursMixin(@joined: &;) {
。
@white: #fff;
@black: #000;
@array: 'white','black';
.coloursMixin(@joined: &;) {
.for(@array); .-each(@array) {
@name: e(@array);
@[email protected]{name} {color: @@name}
}
}
// ............................................................
// .for
.for(@i, @n) {.-each(@i)}
.for(@n) when (isnumber(@n)) {.for(1, @n)}
.for(@i, @n) when not (@i = @n) {
.for((@i + (@n - @i)/abs(@n - @i)), @n);
}
// ............................................................
// .for-each
.for(@array) when (default()) {.for-impl_(length(@array))}
.for-impl_(@i) when (@i > 1) {.for-impl_((@i - 1))}
.for-impl_(@i) {.-each(extract(@array, @i))}
为什么你需要'@ joined'属性?难道你不能简单地用'&。@ {name} {color:@@ name}'来使用一个无参数混合吗?如果你在选择器中调用它,那么这个选择器将接收数组项目类。 – helderdarocha