gpt4 book ai didi

css - SCSS mixin 跳过默认参数

转载 作者:行者123 更新时间:2023-11-28 19:25:56 25 4
gpt4 key购买 nike

我有一些混合:

@mixin flexBox( $directionVlaue: row, $justifyValue: flex-start, $alignValue: baseline ) {
display: flex;
flex-direction: $directionVlaue;
justify-content: $justifyValue;
align-items: $alignValue;
}

现在,如果我使用它并传入参数,是否有可能跳过一个,这样我就不必一直写所有三个参数:

.thing {
@include flexBox(row, center, center);
}

我不想在这里指定 row 因为它是默认值。那么是否可以这样写:

.thing {
@include flexBox( , center, center); // leave first argument empty
}

最佳答案

也许关键字参数?这允许定义特定的参数。

https://sass-lang.com/documentation/at-rules/mixin#taking-arbitrary-keyword-arguments

关于css - SCSS mixin 跳过默认参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56198119/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com