Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Variables 有没有办法读取传递的var并替换其值_Variables_Replace_Properties_Less_Short - Fatal编程技术网

Variables 有没有办法读取传递的var并替换其值

Variables 有没有办法读取传递的var并替换其值,variables,replace,properties,less,short,Variables,Replace,Properties,Less,Short,是否有方法读取传递的变量并替换其值 较少的 使用 传递的t值将替换为单词top,因此其他字母的值为,b表示bottom,等等 我可以传递整个单词,例如:top,但我正在尝试缩短初次混音后键入的文本量。可以对混音进行四次重载: .mar(t, @B){ margin-top: ~'@{B}px'; } .mar(b, @B){ margin-bottom: ~'@{B}px'; } 然而,以这种方式缩写代码的可读性不是很强。不要这样做 .foo1{

是否有方法读取传递的变量并替换其值

较少的 使用 传递的t值将替换为单词top,因此其他字母的值为,b表示bottom,等等


我可以传递整个单词,例如:top,但我正在尝试缩短初次混音后键入的文本量。

可以对混音进行四次重载:

.mar(t, @B){
    margin-top: ~'@{B}px';        
}
.mar(b, @B){
    margin-bottom: ~'@{B}px';        
}
然而,以这种方式缩写代码的可读性不是很强。不要这样做

.foo1{
    .mar(3);
}
.foo2{
    .mar(t,3);
}
.mar(t, @B){
    margin-top: ~'@{B}px';        
}
.mar(b, @B){
    margin-bottom: ~'@{B}px';        
}