我有一个混音:
@mixin transition($duration) {
-webkit-transition: all $durations ease-in-out;
-moz-transition: all $durations ease-in-out;
-ms-transition: all $durations ease-in-out;
-o-transition: all $durations ease-in-out;
transition: all $durations ease-in-out;
}
但是在当前状态下它已被破坏,因为它显然会查找名为$durations
而不是$duration
的变量,然后将s
后缀为秒。有没有办法解决这个问题?
答案 0 :(得分:2)
您需要使用字符串插值:
@mixin transition($duration) {
-webkit-transition: all #{$duration}s ease-in-out;
-moz-transition: all #{$duration}s ease-in-out;
-ms-transition: all #{$duration}s ease-in-out;
-o-transition: all #{$duration}s ease-in-out;
transition: all #{$duration}s ease-in-out;
}
.foo {
@include transition(1);
}