Less mixin 不适用于带逗号的参数

Less mixin is not working for parameters with comma

我尝试使用 Less mixin 但它不起作用,因为我传递了多个线性值:

.MultiStepGradient(@multigrad) {
    background-image: -moz-linear-gradient(@multigrad);
    background-image: -webkit-linear-gradient(@multigrad);
    background-image: -o-linear-gradient(@multigrad);
    background-image: -ms-linear-gradient(@multigrad);
    background-image: linear-gradient(@multigrad);
}

.test {
    .MultiStepGradient(135deg,#202f7c 0%, #7f3689 52%, #7f3689 100%);
}

错误: 找不到 .MultiStepGradient(135deg, #202f7c 0%, #7f3689 52%, #7f3689 100%)

的匹配定义

这样传,转义

.MultiStepGradient(~"135deg,#202f7c 0%, #7f3689 52%, #7f3689 100%")

如果你想按照现在的方式传递它,你可以更改 mixin 以获取多个值

http://lesscss.org/functions/#string-functions-escape

向下滚动一点以查看 e 部分

CSS escaping, replaced with ~"value" syntax.

It expects string as a parameter and return its content as is, but without quotes. It can be used to output CSS value which is either not valid CSS syntax, or uses proprietary syntax which Less doesn't recognize.