-1

我正在尝试使用 SASS 设置多个背景 @mixin,所以这是我的代码:

@mixin background_multiplied($background_1, $background_2: false, $background_3: false) {
  $params: url('../#{$background_1}') $atributes;

  @if $background_2 != false {
    $params: url('../#{$background_1}') $atributes, url('../#{$background_2}') $atributes;
  }
  @if $background_3 != false {
    $params: url('../#{$background_2}') $atributes, url('../#{$background_2}') $atributes, url('../#{$background_3}') $atributes;
  }

  @each $attr in $atributes {
    @if $attr == position_horizontal {
      $position_horizontal: center
    }
    @if $attr == position_vertical {
      $position_vertical: top
    }
    @if $attr == bg_repeat {
      $bg_repeat: no-repeat
    }
    @if $attr == bg_size {
      $bg_size: auto
    }
  }

  background: $params;
}

事情是不对的,我有error (Line 210: Undefined variable: "$atributes".) 任何人可以帮助我吗?非常感谢。

4

1 回答 1

2

错误不言自明。你$atributes到处都调用了这个变量,但它从未被声明过。

于 2013-06-27T10:39:04.170 回答