scss 循环造成的问题

来源:8-10 完成的 storybook 的架构,给剩下的组件添加 stories

香饽饽0

2020-05-13

.cube-loading-spinner {
    position: absolute;
    left: 44.5%;
    top: 37%;
    width: 2px; // for rem
    height: 25%;
    border-radius: 50%/20%;
    opacity: 0.25;
    background-color: currentColor;
    animation: spinner-fade 1s linear infinite;

    @for $i from 1 through 12 {
        &:nth-child(#{$i}) {
            animation-delay: (($i - 1) / 12)s;
            transform: rotate(30deg * ($i - 6)) translateY(-150%);
        }
    }
}

图片描述
有多余空格,如何解决

写回答

1回答

香饽饽0

提问者

2020-05-13

animation-delay: ($i - 1) * 0.08333333333333333s;

改成乘法即五问题,感觉 scss 需要去优化这一点。

0
0

React18+TS高仿AntD从零到一打造组件库

设计,开发,测试,发布再到 CI/CD,从0到1造轮子

2124 学习 · 959 问题

查看课程