关于 sass 的 Mixins

@mixin floorWal($w,$h,$img) {
  width: $w;
  height: $h;
  background: url(./images/$img) no-repeat center;
}

如上 $img 是不执行的 该如何 传入才 可生效呢

生成如下 css

    width: 105px;
    height: 105px;
    background: url(images/$img) center no-repeat;

sass 大神指导一下

解决如下

@mixin floorWal($w,$h,$img) {
  width: $w;
  height: $h;
  background: url(./images/#{$img}) no-repeat center; 
}
阅读 2.2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题