LESS 高级参数和@rest Variable

2018-01-10 11:45 更新

描述

Mixin通过使用 ... 提供可变数量的参数。 您可以通过在变量名称后面放置 ... 为变量赋值参数。

让我们看看一些使用参数的简单格式如下所示:

.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
}

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号