# 1.@mixin混合宏的參數
* * *
## 1.1 傳一個`不帶值`的參數
~~~
@mixin bs($bs){
border-radius: $bs;
}
div{
@include bs(3px);
}
~~~
## 1.2帶一個傳值的參數
~~~
@mixin bs($bs:5px){
border-radius: $bs;
}
.one{
@include bs;
}
div{
@include bs(3px);
}
~~~
## 1.3有一個特別的參數“…”。當混合宏傳的參數過多之時,可以使用參數來替代
~~~
@mixin box-shadow($shadows...){
@if length($shadows) >= 1 {
box-shadow: $shadows;
} @else {
$s: 1 0 2px rgba(#000,.25);
box-shadow: $s;
}
}
~~~
# 2.占位符 %placeholder
* * *
> %placeholder 聲明的代碼,如果不被 @extend 調用的話,不會產生任何代碼
~~~
%mt5{
margin-top: 5px;
}
div{
@extend %mt5;
}
~~~