2019-07-23sass 使用
2019-07-23 本文已影响0人
半眼鱼
1.新建文件global.scss,引入一下文件:
@import "./var";
@import "mixin";
@import "./common";
@import "./vant-theme";
2.在_var文件中声明全局使用的样式如下某些:
$red: #db3d3c;
$gray-deep: #999;
3.在mixin文件中声明全局使用的样式如下某些:
@mixin one-border($direction: bottom){
position: relative;
&::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 200%;
height: 200%;
transform: scale(.5);
transform-origin: 0 0;
pointer-events: none;
box-sizing: border-box;
border-#{$direction}: 1px solid $border-color;
}
}
4.新建文件common.scss,写入一些公共使用的.class
5.新建文件_vant-theme.scss,写入一些公共全局修改的vant样式
6.在main.js引入使用
import '@/assets/scss/global.scss';