您现在的位置是:首页 > 电脑 > 

Sass删除mixin中的地图键(Sass remove a map key inside a mixin)

2025-07-17 01:37:16
Sass删除mixin中的地图键(Sass remove a map key inside a mixin) 地图: $map-breakpoints: ( xs: ( min-width: 0, max-width: 480px ), sm: ( min-width: 481px, max-width: 750p
Sass删除mixin中的地图键(Sass remove a map key inside a mixin)

地图:

$map-breakpoints: ( xs: ( min-width: 0, max-width: 480px ), sm: ( min-width: 481px, max-width: 750px ), md: ( min-width: 751px, max-width: 1170px ) ) !default;

混入:

@mixin example($map: $map-breakpoints) { // i want remove map key `md`, i dont need map key `md` in this mixin }

如何删除上面的mixin中的地图键?

谢谢。

Map:

$map-breakpoints: ( xs: ( min-width: 0, max-width: 480px ), sm: ( min-width: 481px, max-width: 750px ), md: ( min-width: 751px, max-width: 1170px ) ) !default;

Mixin:

@mixin example($map: $map-breakpoints) { // i want remove map key `md`, i dont need map key `md` in this mixin }

How can remove a map key inside a mixin like above?

Thanks.

最满意答案

您可以在地图上查看Sass函数 。 存在map-remove函数,它返回没有传递键的新列表。 例如:

map-remove($map-breakpoints, (md, sm))

该示例将从结果映射中删除md和sm键(及其值)。

You could have a look at the Sass functi on maps. There exists a map-remove function which returns a new list without the passed keys. Ex:

map-remove($map-breakpoints, md, sm) // md, sm are keys of the map

The example will remove both the md and the sm keys (with their values) from the resulting map.

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/648984.html

相关标签:无
上传时间: 2023-07-26 17:25:58
留言与评论(共有 9 条评论)
本站网友 汪辉
3分钟前 发表
max-width
本站网友 红杏酒家
3分钟前 发表
max-width
本站网友 随车吊厂家
25分钟前 发表
max-width
本站网友 陆皓东故居
18分钟前 发表
0
本站网友 麻城楼盘
2分钟前 发表
max-width
本站网友 西安婚庆酒店
0秒前 发表
You could have a look at the Sass functi on maps. There exists a map-remove function which returns a new list without the passed keys. Ex
本站网友 tomahawk
6分钟前 发表
You could have a look at the Sass functi on maps. There exists a map-remove function which returns a new list without the passed keys. Ex
本站网友 明日世界终结时
7分钟前 发表
max-width