12 Star 70 Fork 13

xhhhhh / uni-app-style

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
pm.scss 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
// 定义内外边距,历遍0-600
@for $i from 0 through 600 {
// 只要双数和能被5除尽的数
@if $i % 2 == 0 or $i % 5 == 0 {
// 得出:margin-30或者m-30
.margin-#{$i},
.m-#{$i} {
margin: $i + rpx !important;
}
// 得出:padding-30或者p-30
.padding-#{$i},
.p-#{$i} {
padding: $i + rpx !important;
}
//得出margin-left: 1rpx; margin-right: 1rpx;
.m-x-#{$i} {
margin-left: $i + rpx !important;
margin-right: $i + rpx !important;
}
//得出margin-top: 1rpx; margin-bottom: 1rpx;
.m-y-#{$i} {
margin-top: $i + rpx !important;
margin-bottom: $i + rpx !important;
}
//得出padding-left: 1rpx; padding-right: 1rpx;
.p-x-#{$i} {
padding-left: $i + rpx !important;
padding-right: $i + rpx !important;
}
//得出padding-top: 1rpx; padding-bottom: 1rpx;
.p-y-#{$i} {
padding-top: $i + rpx !important;
padding-bottom: $i + rpx !important;
}
@each $short, $long in l left, t top, r right, b bottom {
// 缩写版,结果如: m-l-30
// 定义外边距
.m-#{$short}-#{$i} {
margin-#{$long}: $i + rpx !important;
}
// 定义内边距
.p-#{$short}-#{$i} {
padding-#{$long}: $i + rpx !important;
}
// 完整版,结果如:margin-left-30
// 定义外边距
.margin-#{$long}-#{$i} {
margin-#{$long}: $i + rpx !important;
}
// 定义内边距
.padding-#{$long}-#{$i} {
padding-#{$long}: $i + rpx !important;
}
}
}
}
CSS
1
https://gitee.com/thebestweb/uni-app-style.git
git@gitee.com:thebestweb/uni-app-style.git
thebestweb
uni-app-style
uni-app-style
master

搜索帮助