我写道:
#colors() {
backgroundDarkPrimary: '#0747A6';
backgroundMedium: '#dfe1e6';
backgroundLight: '#ebecf0';
backgroundLightest: '#F4F5F7';
backgroundLightPrimary: '#D2E5FE';
backgroundLightSuccess: '#E4FCEF';
}
但是当我在 mixin 中使用它时,出现错误:
留意帮助
为什么要将颜色包裹在“”中?
/* less */
#colors() {
background: #0747A6;
}
.mixin( @height: 40px, @background: #colors[background] ) {
height: @height;
background: @background;
}
div {
.mixin;
}