当前位置: 动力学知识库 > 问答 > 编程问答 >

Strange operations behaviour with LESS

问题描述:

This one compiles:

.myclass {

.mymixin(2);

}

.mymixin(@parameter) {

width: ((@parameter*1)*12px);

}

This one does not:

.myclass {

.mymixin(2);

}

.mymixin(@parameter) {

width: ((@parameter-1)*12px);

}

Does anyone have a clue what's the problem with the second one?

网友答案:

Less treats @parameter-1 as a variable as you can tell from the compiler error:

Error line 2: variable @parameter-1 is undefined

If you insert spaces it works as expected:

.mymixin(@parameter) {
    width: ((@parameter - 1)*12px);
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: