我无法让数学 SASS 库在 Vue 应用程序中工作。它使用 Dart Sass 和 sass-loader 编译。Dart Sass 版本是1.26.3,所以数学模块应该可以工作。
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: There is no module with the namespace "math".
@for $i from 2 through 10
&:nth-child(#{$i}) { transition-duration: 300ms + $i * 50ms - 400ms * math.floor($i / 8); }
^^^^^^^^^^^^^^^^^^
}
Run Code Online (Sandbox Code Playgroud)
Chr*_*yes 126
弄清楚了。我需要添加
@use 'sass:math';
Run Code Online (Sandbox Code Playgroud)
在文件的顶部。
小智 13
我可以向您推荐一种自动(惰性)方式 - 您可以使用:
$ npm install -g sass-migrator
$ sass-migrator division **/*.scss
Run Code Online (Sandbox Code Playgroud)
来自: https: //sass-lang.com/documentation/writing-changes/slash-div#automatic-migration