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)) 。 –