sass @for循环中 变量与变量的运算会被忽视?

$section-height:120px;
@for $num from 1 through 10{

.section-#{$num}{
    height: #{$num}*$section-height;
}

}

结果是
.section-1 {
height: 1*120px; }

/ line 42, ../sass/Zigzag-layout.scss /
.section-2 {
height: 2*120px; }

/ line 42, ../sass/Zigzag-layout.scss /
.section-3 {
height: 3*120px; }

/ line 42, ../sass/Zigzag-layout.scss /
.section-4 {
height: 4*120px; }

/ line 42, ../sass/Zigzag-layout.scss /
.section-5 {
height: 5*120px; }

/ line 42, ../sass/Zigzag-layout.scss /
.section-6 {
height: 6*120px; }

/ line 42, ../sass/Zigzag-layout.scss /
.section-7 {
height: 7*120px; }

/ line 42, ../sass/Zigzag-layout.scss /
.section-8 {
height: 8*120px; }

/ line 42, ../sass/Zigzag-layout.scss /
.section-9 {
height: 9*120px; }

/ line 42, ../sass/Zigzag-layout.scss /
.section-10 {
height: 10*120px; }

运算符*被忽略了?

阅读 4.1k
1 个回答
新手上路,请多包涵

.section-#{$num}{

height: $num * $section-height;

}

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进