style文件中定义颜色
1.手动引入
使用文件中 @import '~@/style/.....'
文件可以读取定义的颜色变量
2.自动引入
1)安装插件vue add style-resources-loader
2)vue.config.js添加配置
const path = require('path')
module.exports = {
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
//配置自动化导入样式路径
patterns: [
path.join(__dirname, '/src/styles/variables.less')
]
}
}
}