main.js
import './common/css/base.scss'
base.scss
$testColor: red;
@function getColor() {
@return red;
}
在别的 vue 里使用 base.scss
<style scoped lang="scss">
/* 这两个都不起作用 */
div {
background: getColor();
}
div {
background: $testColor;
}
</style>
}
如果直接在 base.scss 中这样写是可以的,说明文件还是全局引入成功了
div {
background: red;
}