vue项目的scss的使用
- 首先应该安装相应的解析scss的包。
npm install vue-style-loader --sava-dev
npm install node-sass sass-loader --save-dev
- 然后在assets中写下scss后缀名的文件,然后在全局引入之后,在我们需要的地方也要单独引入一下。
//全局引入一下
import '@/assets/public.scss'
//单独组件引入
<style lang="scss" scoped>
@import "@/assets/public.scss";
:deep(el-button) {
// 这个是elementUI的写法
background-color: $--color-primary;
}
.box {
width: 400px;
height: 500px;
background-color: $bgcolor;
}
.box1 {
width: 400px;
height: 500px;
background-color: $bgcolor1;
}
</style>