css中 @mixin的使用
mixin定义(使用@mixin定义): @mixin hexagon-generator($hexagon-width, $factor, $border-radius){ display: inline-block; border-radius: 50%; width: ($hexagon-width + $border-radius) * $factor; height: ($hexagon-width + $border-radius) * $factor; display: flex; align-items: center; justify-content: center; } .hexagon-shape { @include hexagon-generator(88rpx, 1, 8rpx); } 使用 .hexagon-shape { display: inline-block; border-radius: 50%; width: (88rpx + 8rpx) * 1; height: (88rpx + 8rpx) * 1; display: flex; align-items: center; justify-content: center; } 转载: https://blog.csdn.net/liya_nan/article/details