我正在尝试在同一图中将一个值写入另一个值。
$map: (
"height": (
"default": 5px,
"media": (
"768": map-get(map-get($map, "height"), "default") * 5 /* [ 1 ] */
)
)
);
.class {
height: map-get(map-get($map, "height"), "default"); /* [ 2 ] */
}
@media (min-width: 768px) {
.class {
height: map-get(map-get(map-get($map, "height"), "media"), "768"); /* [ 3 ] */
}
}
答案 0 :(得分:0)
您可以在一个外部变量中设置默认高度:这很简单;-)
$defaultHeight:5px;
$map: (
"height": (
"default": $defaultHeight,
"media": (
"768": $defaultHeight * 5 /* [ 1 ] */
)
)
);
.class {
height: map-get(map-get($map, "height"), "default"); /* [ 2 ] */
}
@media (min-width: 768px) {
.class {
height: map-get(map-get(map-get($map, "height"), "media"), "768"); /* [ 3 ] */
}
}