更少的编译器不适用于提取功能

less compiler not work with extract function

经过多次测试后,我不明白为什么 "extract" 或 "at" 函数在 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
}
each(@backgroundcolors, {

  .color-@{key}{
    background-color: @value;
    color: @index;

    a:at(@colors,bg-blue);
    b:at(@colors,"bg-blue");
    c:extract(@colors,0);
  }
});

file.css

    .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);
    }

在我的结果中,.test 不仅包含索引 0,还包含 @list 中的任何其他项目。在 sencod 尝试中,我尝试在每个循环中使用 "at" 或 "extract",但在这种情况下我总是失败。现在我使用 lessc 3.9.0

我哪里做错了?

extract 函数的索引从 1 开始:

@list: apple, pear, coconut , orange;

a {
  value: extract(@list, 1); // value: apple
}

使用maps

@colors: {
  dark: #2f353b;
  blue: #3598dc;
}

a {
  color: @colors[dark]; // color: #2f353b
}

不知道 at 是什么意思。