开发学院

您的位置:首页>教程>正文

教程正文

LESS 高级参数和@rest变量

LESS的高级参数和@rest变量

  混合可以使用..来代表可变的参数。你可以在变量名...之后把参数赋值给变量.

例子

.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

}