vue其他scss预处理之“复用mixin”

9 篇文章 0 订阅

1.创建mixin.scss文件夹

//flex布局复用
@mixin flex($hov:space-between,$col:center){//水平 垂直
  display: flex;
  justify-content: $hov;
  align-items: $col;
}

//封装小图标
@mixin bgImg($w:0,$h:0,$img:'',$size:contain){
  display: inline-block;
  background: url($img)no-repeat center;
  background-size:$size;
  width: $w;
  height: $h;
  margin-right: 4px;
}

//水平垂直居中
@mixin hov_col($top:0,$right:0,$bottom:0,$left:0){
  position: absolute;
  top: $top;
  bottom: $bottom;
  right: $right;
  left: $left;
  margin: auto;
}

@mixin position($pos,$top,$left,$w,$h){
 position: $pos;
  top:$top;
  left:$left;
  width: $w;
  height:$h;
}


@mixin positionImg($pos:absolute,$top:0,$right:0,$w:0,$h:0,$img:''){
  position:$pos;
  top:$top;
  right: $right;
  width: $w;
  height: $h;
  background: url($img)no-repeat center;
  background-size:contain;


}

2.在组件中使用的时候先,导入

3.然后,使用@include xx进行调用—复用的样式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值