Less 较少的编译器无法使用提取函数
经过多次测试,我不明白为什么“提取”或“在”功能在较少的工作。 我尝试在我的less文件中使用这些函数,但没有成功 file.lessLess 较少的编译器无法使用提取函数,less,Less,经过多次测试,我不明白为什么“提取”或“在”功能在较少的工作。 我尝试在我的less文件中使用这些函数,但没有成功 file.less @list: apple, pear, coconut , orange; .test{ color:extract(@list,0); } @backgroundcolors:{ dark: #AA2222; blue: #AA3333 } @colors: { bg-dark: #2f353b; bg-blue: #3598dc } ea
@list: apple, pear, coconut , orange;
.test{
color:extract(@list,0);
}
@backgroundcolors:{
dark: #AA2222;
blue: #AA3333
}
@colors: {
bg-dark: #2f353b;
bg-blue: #3598dc
}
each(@backgroundcolors, {
.color-@{key}{
background-color: @value;
color: @index;
a:at(@colors,bg-blue);
b:at(@colors,"bg-blue");
c:extract(@colors,0);
}
});
.test {
color: extract(apple, pear, coconut, orange, 0);
}
.color-dark {
background-color: #AA2222;
color: 1;
a: at(, bg-blue);
b: at(, "bg-blue");
c: extract(, 0);
}
.color-blue {
background-color: #AA3333;
color: 2;
a: at(, bg-blue);
b: at(, "bg-blue");
c: extract(, 0);
}
file.css
@list: apple, pear, coconut , orange;
.test{
color:extract(@list,0);
}
@backgroundcolors:{
dark: #AA2222;
blue: #AA3333
}
@colors: {
bg-dark: #2f353b;
bg-blue: #3598dc
}
each(@backgroundcolors, {
.color-@{key}{
background-color: @value;
color: @index;
a:at(@colors,bg-blue);
b:at(@colors,"bg-blue");
c:extract(@colors,0);
}
});
.test {
color: extract(apple, pear, coconut, orange, 0);
}
.color-dark {
background-color: #AA2222;
color: 1;
a: at(, bg-blue);
b: at(, "bg-blue");
c: extract(, 0);
}
.color-blue {
background-color: #AA3333;
color: 2;
a: at(, bg-blue);
b: at(, "bg-blue");
c: extract(, 0);
}
在我的result.test中,不仅包含索引0,还包含@list中的任何其他项。在sencod尝试中,我在each循环中尝试使用“at”或“extract”,但在这种情况下,我总是失败。现在我使用LESSC3.9.0
我哪里做错了?函数的索引从1开始:
@list: apple, pear, coconut , orange;
a {
value: extract(@list, 1); // value: apple
}
使用:
不知道at的是什么意思