# vue.config.js
参数可以参考: 官方传送门 (opens new window)
# 参数
项目中 用到的重要的配置......
# 全局配置样式
# 步骤1. vue.connfig.js文件中
自己在项目中(vue3的项目)使用过的,自己全局配置的scss样式
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
// ...
// 引入全局样式
css: {
loaderOptions: {
scss: {
additionalData: `@import "@/styles/scss/variable.scss";`, //引入全局变量
},
},
},
// ...
})
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# 步骤2. 初始化scss样式文件夹
自己建的src/styles/scss/
gitee中也存了具体哪写文件 (opens new window)
// scss/variable.scss
$color-background:#ccc;
$font-size-small:12px;
1
2
3
2
3