需要将@color-1
,@color-2
,@color-3
,...放在@color-@{i}
的循环中。我该怎么办呢?
@color-0: rgb(200, 20, 20);
@color-1: ...;
@color-2: ...;
// ...
.generate-headers(5);
.generate-headers( @n, @i: 0 ) when ( @i =< @n ) {
.widget-header-@{i} {
width: (@i * 100% / @n);
background-color: @color-@{i};
color: overlay( @color-@{i}, @white );
}
.generate-headers(@n, (@i + 1));
}
答案 0 :(得分:1)
@color: "color-@{i}";
background-color: @@color;