1
我需要的变量name
更改为trees
,balloons
等在一个循环,以获得在一个循环改变的变量名
.trees{ color:1;}
.balloons { color:2;}
,但我得到相反:
.trees{color:2}
.name{color:1}
试过这种混入但没有工作,我做错了什么?
@name:name;
.name(@index) when (@index = 2) {@name: balloons;}
.name(@index) when (@index = 1) {@name: trees;}
.name(@index) when (@index > 0) {
[email protected]{name}{ color:@index; }
.name(@index - 1)
}
.name(2);
尼斯和问题的最佳解决方案:) – Harry
感谢帮助dajnz – thenine
尽管将整个代码片段包含到答案中也很方便(毕竟它只是[几行代码](https://gist.github.com/seven-phases-max/14a2e640cf20897e27f8)) 。 –