首先我设置一个function
.generate-font-size(@n, @i: 1) when (@i =< @n) {
.font-size-@{i} {
font-size: @i+px;
}
.generate-font-size(@n, (@i + 2));
}
然后执行
.generate-font-size(24,12);
结果中字符串拼接中间多了个空格
.font-size-12 {
font-size: 12 px;
}
.font-size-14 {
font-size: 14 px;
}
.font-size-16 {
font-size: 16 px;
}
.font-size-18 {
font-size: 18 px;
}
.font-size-20 {
font-size: 20 px;
}
.font-size-22 {
font-size: 22 px;
}
.font-size-24 {
font-size: 24 px;
}
要怎么才能去掉空格???