混入采用可变数量的参数可使用... 。可以通过放置...变量名后分配参数变量。
让我们来看看一些简单的格式使用参数如下图所示:
.mixin(...) { // it matches arguments from 0-n .mixin() { // it matches exactly 0 arguments .mixin(@x: 1) { // it matches arguments from 0-1 .mixin(@x: 1; ...) { // it matches arguments from 0-n .mixin(@x; ...) {
您可以在代码使用 @rest 变量:
.mixin(@x; @rest...) { // after the variable @a, the @rest is bound to arguments // @arguments is bound to all arguments }
上一篇:
Less @arguments变量
下一篇:
Less模式匹配