我需要聲明一個LESS混入用的參數個數可變,並把它傳遞給混入,這樣列表:變量的在LESS混入參數
.linear-gradient(@color1, @color2) {
background: -webkit-linear-gradient(@color1, @color2);
background: -o-linear-gradient(@color1, @color2);
background: -moz-linear-gradient(@color1, @color2);
background: linear-gradient(@color1, @color2);
}
.linear-gradient(@color1, @color2, @color3) { ...
.linear-gradient(@color1, @color2, @color3, @color4) { ...
... // usage with a variable number of arguments:
body > header {
.linear-gradient(red, yellow, blue);
如上所述in the documentation我可以使用@arguments
和@rest
關鍵字,但不適合我究竟是如何應該在我的情況下使用非常清楚......
@哈利:「重複」的OP不處理'@參數'我問 – Serge
請檢查** esp **發佈的答案。問題可能不同,但解決方案是相同的(你可以在Amit發佈的答案中看到它)。 – Harry
@哈里:它可能適合,但** esp **沒有提到';'詳細 – Serge