如果在空节目中的混音符中默认
是否可以使用可以覆盖当前代码块的混合蛋白?我想拥有它,以便如果@mixin为空,盒子的背景将是空的,然后以橙色显示,但是当我删除@mixin时,它不会更改为橙色?我在做什么错?
@mixin box {
background: red;
}
.box {
@if box {
@include box;
} @else {
background: orange;
}
}
Is it possible to have a mixin that can override a current code block? I want to have it so that if the @mixin is empty the background for the box would be empty and then show in orange, but when I remove the @mixin it does not change to orange? What am I doing wrong?
@mixin box {
background: red;
}
.box {
@if box {
@include box;
} @else {
background: orange;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
$ color:null
仅用于设置值,如果您没有传递@mixin
的值。之后,您可以使用@if
@else
轻松地在@mixin
内检查。SASS
HTML
The
$color: null
is just for setting a value if you didn't pass a value for your@mixin
. after that you can check easily inside your@mixin
using@if
@else
.Sass
Html