-
安装less、less-loader、style-resources-loader 和 vue-cli-plugin-style-resources-loader
-
Create a global color file, here is the baseColor.less file
-
Configure it in the vue.config.js file, and the path is the path of the global color file just created, that is, the path of the baseColor.less file. Note that the path here cannot be abbreviated, such as @/assets
const path = require('path') pluginOptions: { 'style-resources-loader': { preProcessor: 'less', patterns: [path.resolve(__dirname, './src/assets/style/baseColor.less')] } }
-
Finally, you can use it directly where you need it
Vue2 defines global color styles
Guess you like
Origin blog.csdn.net/qq_37344867/article/details/127072414
Recommended
Ranking