Skip to content

Commit 023d13f

Browse files
committed
🚨 fix sass breaking change: slash as division
1 parent b3ec2f6 commit 023d13f

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

qmui/mixin/tool/_calculate.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@charset "utf-8";
22

3+
@use "sass:math";
4+
35
////
46
/// 辅助数值计算的工具方法
57
/// @author Kayo
@@ -91,7 +93,7 @@
9193
/// @param {Number | String} $parent - 较大的长度值
9294
/// @param {Number | String} $child - 较小的长度值
9395
@function getLengthMaxIntegerCenter($parent, $child) {
94-
$center: ($parent - $child) / 2;
96+
$center: math.div($parent - $child, 2);
9597
// 注意这里的取整使用 ceil 而不是 floor 并不是随意写的,这是模拟现代浏览器对于小数点长度值的表现而定的。
9698
// 例如,margin-top: 10.5px 在现代浏览器中会表现为 margin-top: 11px 而不是 margin-top: 10px
9799
// 又例如,margin-top: -10.5px 在现代浏览器的表现等同于 margin-top: -10px 而不是 margin-top: -11px
@@ -130,7 +132,7 @@
130132
@function sqrt($num) {
131133
$temp:1;
132134
@while abs($temp - $num / $temp) > 1e-6 {
133-
$temp: ($temp + $num/$temp) / 2;
135+
$temp: ($temp + $num / $temp) / 2;
134136
}
135137
@return $temp;
136138
}

qmui/mixin/tool/_effect.scss

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@charset "utf-8";
22

3+
@use "sass:math";
4+
35
////
46
/// 辅助编写样式效果的工具方法
57
/// @author Kayo
@@ -25,7 +27,7 @@
2527
position: absolute;
2628
left: 50%;
2729
top: 50%;
28-
margin: (-$height) / 2 0 0 (-$width) / 2;
30+
margin: math.div(-$height, 2) 0 0 math.div(-$width, 2);
2931
}
3032

3133
%triangleCommonStyle {
@@ -50,25 +52,25 @@
5052
@extend %triangleCommonStyle;
5153
/* 向上小三角 */
5254
@if $direction == top {
53-
border-width: $height $width / 2;
55+
border-width: $height math.div($width, 2);
5456
border-top: 0;
5557
border-bottom-color: $borderColor;
5658
}
5759
/* 向下小三角 */
5860
@else if $direction == bottom {
59-
border-width: $height $width / 2;
61+
border-width: $height math.div($width, 2);
6062
border-bottom: 0;
6163
border-top-color: $borderColor;
6264
}
6365
/* 向左小三角 */
6466
@else if $direction == left {
65-
border-width: $width / 2 $height;
67+
border-width: math.div($width, 2) $height;
6668
border-left: 0;
6769
border-right-color: $borderColor;
6870
}
6971
/* 向右小三角 */
7072
@else if $direction == right {
71-
border-width: $width / 2 $height;
73+
border-width: math.div($width, 2) $height;
7274
border-right: 0;
7375
border-left-color: $borderColor;
7476
}
@@ -183,7 +185,7 @@
183185
}
184186
height: 300%;
185187
border-radius: $borderRadius * 3;
186-
transform: scale((1 / 3));
188+
transform: scale(math.div(1, 3));
187189
}
188190
}
189191
}

0 commit comments

Comments
 (0)