0
点赞
收藏
分享

微信扫一扫

scss 提示 SassError: There is no module with the namespace “math“.

残北 2022-06-30 阅读 79

scss 提示 SassError: There is no module with the namespace “math”.

参考问题: ​​https://stackoverflow.com/questions/61330432/sasserror-there-is-no-module-with-the-namespace-math​​

在使用 ​​scss​​​ 的时候,使用了一些 math 上的方法,比如除以 ​​math.div()​​​ ​​math.floor​​ 等,就会出现这样的错误

SassError: There is no module with the namespace "math".

解决办法:

在当前文档 ​​style​​ 标签内的最上方,注意,是最上方,在所有代码之前,添加:

<style lang="scss" scoped>
@use "sass:math";

@import "other-style"
@import "other-style"
@import "other-style"
</style>

就好了。

如果你没有添加上最上方,在编译的时候也会提示你 ​​@use​​ 代码需要在所有代码之前使用。


举报

相关推荐

scss

0 条评论