混合
(一)LESS源码
//混合函数,在混合函数中可以直接设置变量,也可以给变量一个默认值
.test(@w: 100px, @h: 200px, @bg-color: red) {
width: @w;
height: @h;
border: 1px solid @bg-color;
}
div {
//调用混合函数,按顺序传递参数
// .test(200px,300px,#bfa);
//如果不给参数,则会使用test中的默认参数,但是这里给了一个参数,则默认给到@w
.test(300px);
//还可以指定赋值,这时候就不需要注意顺序问题了
// .test(@bg-color:red, <