1.首先安装依赖
"node-sass": "^7.0.1",
"sass": "^1.49.9",
"sass-loader": "^12.6.0",
"style-loader": "^3.3.1",
"style-resources-loader": "^1.5.0",
npm install XXX(上面的包) --save-dev
如果安装出现安装的包一直显示在运行时依赖中,将它们剪切到开发时依赖项中重新npm install
2.新建vue.config.js
配置
module.exports = {
pluginOptions: {
'style-resources-loader': {
preProcessor: 'sass',
patterns: []
}
}
}
3.项目中使用
<style lang='scss'>
</style>