1,安装style-resources-loader:vue add style-resources-loader;
2,在vue.config.js中的pluginOptions添加第三方插件:
a,引入路径:const path = require('path');
b,配置:
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
patterns: [
path.resolve(__dirname, './src/assets/custom.less')
]
}
},
3,在定义的less文件上部声明文件采用 UTF-8 编码:
@charset "UTF-8";