Deprecation Warning: $saturation: Passing a number without unit % (84) is deprecated.
时间: 2024-11-30 11:16:45 浏览: 33
当在Sass中遇到Deprecation Warning,比如关于 `$weight` 或 `$saturation` 的提示,它表示你正在使用的某种语法格式即将废弃,但当前版本仍支持旧的写法。在这种情况下:
- 对于 `$weight`,如你提到的,Sass 以前允许不带单位的数值,但这已不再是推荐的做法。如果你看到 `Passing a number without unit % (84)`,意味着你传递了一个纯数值(如84),而不是百分比,这将触发警告。为了消除警告并保持未来兼容性,你应该给数值后面加上百分比,例如 `84%`。
- 对于 `$saturation`,如果函数期望的是饱和度作为百分比,那么传入一个没有单位的数(如84)同样会导致警告。有效的CSS饱和度值通常以百分比形式给出,如 `84%`。
修复这个问题的方法是更新代码,使其符合Sass的新建议,例如:
```scss
$saturation: 84%; // 更改这里,添加百分比
// ...
color: mix($--tag-success-color, $--color-white, $saturation);
```
相关问题
我在使用Vue的过程中,出现了Deprecation Warning: $weight: Passing a number without unit % (0) is deprecated.
这个警告是因为你在使用 `deep` 选项时,没有为其设置一个有效的单位。在Vue 2.x 中,`deep` 选项默认为 `false`,如果你不需要它,可以直接省略。如果你需要使用 `deep` 选项,请为其设置一个有效的单位,如 `%`。
例如,如果你想为 `deep` 选项设置为 `true`,你可以这样写:
```javascript
<template>
<div :style="{ '--weight': '100%' }">
<div v-deep>
// ...
</div>
</div>
</template>
<script>
export default {
// ...
};
</script>
<style>
div[v-deep] {
font-weight: var(--weight);
}
</style>
```
这样,你就可以避免出现 Deprecation Warning: $weight: Passing a number without unit % (0) is deprecated. 的警告了。
Passing a number without unit % (84) is deprecated.
The warning "Deprecation Warning: Using / for division is deprecated" in Dart Sass indicates that the use of `/` to perform integer division, which might result in unexpected behavior due to implicit type coercion, is no longer recommended in future versions. To address this issue, you should explicitly convert one of the operands to a float before performing the division[^1]. For example:
```scss
$number: 84;
$newNumber: $number / 10; // Replace with $number * (1/10) or $number / 1 if you want a float
```
As for your second concern about port settings, it seems like setting `http_port` to a specific number like 3090 isn't working as expected when opening your router's log. The default port of 3000 is being used instead. When using `sudo lsof -i`, it's not showing any process bound to port 3090[^2]. You may need to check your configuration file, server setup, or restart your service specifying the correct port.
阅读全文