css - scss自定义mixin覆盖更改值不替换,但添加它
问题描述
我想覆盖边界半径值0到4px。
不替换,但添加它。我究竟做错了什么?
@import:主题.scss:
.uk-button {
border-radius: 0;
@if(mixin-exists(hook-button)) { @include hook-button(); }
}
自定义.scss:
// Custom mixin overwrites
// that's correct?
@mixin hook-button() {
border-radius: 4px;
}
意外结果:
.uk-button {
border-radius: 0;
border-radius: 4px;
}
预期结果:
.uk-button {
border-radius: 4px;
}
解决方案
@include
,正如它所说,仅添加/包含特定规则,但不会替换它们。
主题 SCSS 应如下所示:
.uk-button {
@if(mixin-exists(hook-button)) { @include hook-button(); }
@else { border-radius: 0; }
}
推荐阅读
- python - 我找不到是什么导致我的程序在我之后停止工作,但一切都变成了单独的功能
- flutter - 如何在颤振中定义自定义文本主题?
- laravel - 特定 ID 异常 laravel 5.4/5.5
- python - Spyder 在导入 DBSCAN 3 次时抛出 AttributeError: 'NoneType' object has no attribute 'modules'
- reactjs - 未调用 ComponentDidMount
- c# - 如何在 C# 应用程序中匹配设置文件的 xml 节点
- python - 错误:预期的字符串或类似字节的对象
- mainframe - 如何使用 REXX 订购 control m 作业?像 Control m 实用程序 CTMAPI
- html - 如何设置我的网址仅在一段时间内可用?反应
- python - IO Errno 13 权限被拒绝