Closed rockey2020 closed 3 years ago
It doesn't work
Not less bug, just a Math
logic error.
You write a invalid math compute @witdh: (@designWidth / @i)
(the @i variable can be zero!).
- .loop (@className, @i) when (@i >= 0) {
+ .loop (@className, @i) when (@i > 0) {
.@{className}-@{i} {
@witdh: (@designWidth / @i);
width: @witdh * @i;
}
.loop(@className, @i - 1);
}
non-zero / zero
=> we get a Infinity
, and then we compute @witdh * @i
, get a NaN
.
So you will encount this error log:
var Dimension = function (value, unit) {
this.value = parseFloat(value);
if (isNaN(this.value)) {
throw new Error('Dimension is not a number.');
}