LESS类名字符串插值不工作 [英] LESS class name string interpolation not working
本文介绍了LESS类名字符串插值不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在将网格翻译为LESS,但我似乎无法找出字符串插值。
这里是帮助类,应该生成所有的列:
.createColumns(@ colNumber + 1){}
.createColumns(@index)when (@index< @colNumber){
(〜.col @ {index}){
width:@baseWidth * @index;
}
.createColumns(@index + 1);
}
.createColumns(01);问题是,我收到一个错误,说这是错误的这个部分( 〜.col @ {index})
。
以下是错误讯息:
ParseError:无法识别的输入
在第17行第4列的grid.css中:
16 .createColumns(@index)when(@index< @colNumber ){
17(〜.col @ {index}){
18 width:@baseWidth * @index;
我已经检查了几个例子,并且都使用相同的语法,所以我不知道失踪。
这也是我的一个尝试,导致一个错误:
.createColumns(@index)when index< @colNumber){
@class:col@index;
。(@ class){
width:@baseWidth * @index;
}
.createColumns(@index + 1);
}
解决方案 1.4.x,使用
.col @ {index} {
width:@baseWidth * @index;
}
。
I am currently translating my grid into LESS, but I can't seem to figure out string interpolation.
Here's helper class that is supposed to generate all my columns:
.createColumns (@colNumber+1) {}
.createColumns (@index) when (@index < @colNumber) {
(~".col@{index}") {
width: @baseWidth * @index;
}
.createColumns (@index + 1);
}
.createColumns (01);
Problem is, I get error that says something is wrong with this part (~".col@{index}")
.
Here's the error message:
ParseError: Unrecognised input
in grid.css on line 17, column 4:
16 .createColumns (@index) when (@index < @colNumber) {
17 (~".col@{index}") {
18 width: @baseWidth * @index;
I have checked several examples and all use same syntax, so I'm not sure what I'm missing.
This was also one of my tries that resulted in an error:
.createColumns (@index) when (@index < @colNumber) {
@class : "col"@index;
.(@class) {
width: @baseWidth * @index;
}
.createColumns (@index + 1);
}
解决方案 Escaped selector interpolation is deprecated in 1.4.x, use
.col@{index} {
width: @baseWidth * @index;
}
instead.
这篇关于LESS类名字符串插值不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文