scss @mixin & @include

定义一个带参数和默认值的mixin class
// demo.scss 
@mixin button($background:#606266) {
    font-size: 1em;
    padding: 0.5em 1.0em;
    text-decoration: none;
    color: #fff;
    background: $background;
}
@include 引用带参数的mixin class
@import "./demo.scss";
.button-green {
  //@include button(#409ffe); // OK的
    @include button($background: green);  // OK的
}
posted @ 2020-07-22 10:43  荣光无限  阅读(660)  评论(0编辑  收藏  举报