sass - Mixin 不输出@each 函数
问题描述
我正在尝试@each,它在没有@mixin 的情况下可以正常工作,但是当我使用@mixin 使其灵活时,它不会输出任何内容。我无法弄清楚我错过了什么?
$buttons : (
default : $color-primary,
success : #63cc82,
error : #e4757e,
warning : #fd7856,
info : #927bc1,
)
混音
@mixin themes($map){
@each $button, $color in $map {
&--#{$button}{
background:$color;
}
}
}
我这样称呼它
@include themes(buttons)
解决方案
您需要将地图作为变量传递,如下所示:
@include themes($buttons)
推荐阅读
- php - 续订日期计算
- laravel - Laravel 8 中的自定义电子邮件验证
- f# - F# - 联合案例名称中的句点
- python - 如何遍历两个不同长度的字典?
- excel - 在VBA中,取消选中复选框后如何让组合框删除项目?
- typescript - Typescript Generic 基于子类类型
- javascript - 如何在不自动更改 React Native 中 tabBarIcon 和 tabBarLabel 的位置的情况下增加反应导航 tabBar 的标签栏高度?
- node.js - 使用 ReactJS 前端和 NodeJS 后端实现 webhook
- javascript - fluent-ffmpeg 视频有拉伸图像
- unity3d - Unity Animator 组件在不同场景中为空