1
我有這樣的代碼片段:如何在LESS中的變量中使用變量名?
// Color settings
.setCat(@x) {
[email protected]{x} {
.menu-link {
&.selected, &:hover { background: [email protected]{"[email protected]{x}"}; }
&:hover:after { border-top-color: [email protected]{"[email protected]{x}"}; }
&:only-child:after { border-top-color: transparent; }
}
.menu-link-submenu { background: [email protected]{"[email protected]{x}"}; }
}
}
.setCat(1);
我希望你能看到什麼,我試圖做的。我想要@CatColor1輸出,然後將LESS編譯成存儲在該變量中的我的十六進制顏色。
這可能嗎?有沒有更好的辦法?
你的代碼,雖然全面,缺乏足夠的解釋。我想幫忙,但我也想讓你稍微詳細說明一下。 – AdityaSaxena