Код: Выделить всё
In Sass document, @each does not mention only one element.
https://sass-lang.com/documentation/at-rules/control/each
It works well when multiple elements are used as in the example.
under the code I used.
< /code>
sendКод: Выделить всё
@include buttonSelect(
(
"album-clear" $button-default-color,
"album-preview" $button-sub-color,
"album-add" $button-main-color
)
);
< /code>
acceptКод: Выделить всё
@mixin buttonSelect($buttons) {
@each $name, $color in $buttons {
.#{$name}-button {
color: $color;
border-color: $color;
}
}
}
< /code>
But, when only one element is used, it expresses the following error.
under, code with error
sendКод: Выделить всё
@include buttonSelect(("inspect-write" $button-main-color));
< /code>
errorКод: Выделить всё
< /code>
Module build failed (from ./node_modules/react-scripts/node_modules/sass-loader/dist/cjs.js):
SassError: argument $coloron line 21 of src/views/scss/mixins/button.scss, in function rgba
from line 21 of src/views/scss/mixins/button.scss, in mixin buttonSelect
from line 27 of src/views/components/modal/exception/umbuminspect.scss
background-color: rgba($color: $color, $alpha: 1);
< /code>
< /blockquote>
< /blockquote>
----------------------------------^< /p>
< /code>
why?
Подробнее здесь: https://stackoverflow.com/questions/749 ... nt-is-used
Мобильная версия