0

I have a mixin I'm creating for generating grids in LESS:

/*Grid*/
@num-cols: 12;
@rowWidth: 100%;
@container-lateral-padding: 1em;
@col-margin-right: 3.8%;
@col-unit: (@rowWidth + @col-margin-right) / @num-cols;
@col-identifier: "col";
@col-identifier-nums: false;
@col-identifier-names: true;

@column-selector-number-at-end: false;
@column-selector-number-at-beginning: true;

.setGrid(@index) when (@index > 1), (@column-selector-number-at-end == false) {
    (~".@{index}-@{colNotation}") {
        width: @col-unit * @index - @col-margin-right;
    }
    .setGrid(@index - 1);
}
.setGrid(0) {}
.setGrid(@num-cols);

But I will get the error:

No matching definition was found for .setGrid()

What am I doing wrong here?

4

1 回答 1

1

你的问题就在这里:when (@index > 1). 您没有关于值何时为的情况1(因此出现“无匹配定义”错误)。所以你需要when (@index >= 1).

于 2013-02-02T03:30:03.897 回答