sixyearsorless 2020-05-27
1、先安装依赖包sass-resources-loader:
npm install sass-resources-loader --save-dev
2、配置文件:build/util.js下
// less: generateLoaders(‘less‘), less: generateLoaders(‘less‘).concat({ loader: ‘sass-resources-loader‘, options: { resources: path.resolve(__dirname, ‘../src/assets/css/public/var.less‘) // var.less为新建的全局变量的文件 } }),
具体修改代码截图:
3、重启后测试是否成功:
background-color: blue;background-color: yellow;<input type="button" value="变蓝" @click="changeColorT