flex布局样式 类名化scss(sass)

devtools/2024/11/20 19:10:53/

sass 和less 语法有差异需要转化一下


$directionList: row, row-reverse, column, column-reverse;
$justifyContentList: flex-start, flex-end, center, space-between, space-around, space-evenly;
$alignItemsList: flex-start, flex-end, center, baseline, stretch;@mixin generateFlex($dr, $JC, $AI, $dir, $jc, $ai) {@if ($ai == center) {// flex-x-center.flex-#{$dr}-#{$JC} {display: flex;flex-direction: $dir;justify-content: $jc;align-items: center;}} @else {.flex-#{$dr}-#{$JC}-#{$AI} {display: flex;flex-direction: $dir;justify-content: $jc;align-items: $ai;}}
}@each $dir in $directionList {$dr: if($dir == row, x, if($dir == column, y, $dir));@each $jc in $justifyContentList {$JC: if($jc == flex-start, start, if($jc == flex-end, end, if($jc == space-between, between, if($jc == space-evenly, evenly, if($jc == space-around, around, $jc)))));@each $ai in $alignItemsList {$AI: if($ai == flex-start, start, if($ai == flex-end, end, $ai));@include generateFlex($dr, $JC, $AI, $dir, $jc, $ai);}}
}

编译后

.flex-x-start-start {align-items: flex-start;display: flex;flex-direction: row;justify-content: flex-start;
}
.flex-x-start-end {align-items: flex-end;display: flex;flex-direction: row;justify-content: flex-start;
}
.flex-x-start {align-items: center;display: flex;flex-direction: row;justify-content: flex-start;
}
.flex-x-start-baseline {align-items: baseline;display: flex;flex-direction: row;justify-content: flex-start;
}
.flex-x-start-stretch {align-items: stretch;display: flex;flex-direction: row;justify-content: flex-start;
}
.flex-x-end-start {align-items: flex-start;display: flex;flex-direction: row;justify-content: flex-end;
}
.flex-x-end-end {align-items: flex-end;display: flex;flex-direction: row;justify-content: flex-end;
}
.flex-x-end {align-items: center;display: flex;flex-direction: row;justify-content: flex-end;
}
.flex-x-end-baseline {align-items: baseline;display: flex;flex-direction: row;justify-content: flex-end;
}
.flex-x-end-stretch {align-items: stretch;display: flex;flex-direction: row;justify-content: flex-end;
}
.flex-x-center-start {align-items: flex-start;display: flex;flex-direction: row;justify-content: center;
}
.flex-x-center-end {align-items: flex-end;display: flex;flex-direction: row;justify-content: center;
}
.flex-x-center {align-items: center;display: flex;flex-direction: row;justify-content: center;
}
.flex-x-center-baseline {align-items: baseline;display: flex;flex-direction: row;justify-content: center;
}
.flex-x-center-stretch {align-items: stretch;display: flex;flex-direction: row;justify-content: center;
}
.flex-x-between-start {align-items: flex-start;display: flex;flex-direction: row;justify-content: space-between;
}
.flex-x-between-end {align-items: flex-end;display: flex;flex-direction: row;justify-content: space-between;
}
.flex-x-between {align-items: center;display: flex;flex-direction: row;justify-content: space-between;
}
.flex-x-between-baseline {align-items: baseline;display: flex;flex-direction: row;justify-content: space-between;
}
.flex-x-between-stretch {align-items: stretch;display: flex;flex-direction: row;justify-content: space-between;
}
.flex-x-around-start {align-items: flex-start;display: flex;flex-direction: row;justify-content: space-around;
}
.flex-x-around-end {align-items: flex-end;display: flex;flex-direction: row;justify-content: space-around;
}
.flex-x-around {align-items: center;display: flex;flex-direction: row;justify-content: space-around;
}
.flex-x-around-baseline {align-items: baseline;display: flex;flex-direction: row;justify-content: space-around;
}
.flex-x-around-stretch {align-items: stretch;display: flex;flex-direction: row;justify-content: space-around;
}
.flex-row-reverse-start-start {align-items: flex-start;display: flex;flex-direction: row-reverse;justify-content: flex-start;
}
.flex-row-reverse-start-end {align-items: flex-end;display: flex;flex-direction: row-reverse;justify-content: flex-start;
}
.flex-row-reverse-start {align-items: center;display: flex;flex-direction: row-reverse;justify-content: flex-start;
}
.flex-row-reverse-start-baseline {align-items: baseline;display: flex;flex-direction: row-reverse;justify-content: flex-start;
}
.flex-row-reverse-start-stretch {align-items: stretch;display: flex;flex-direction: row-reverse;justify-content: flex-start;
}
.flex-row-reverse-end-start {align-items: flex-start;display: flex;flex-direction: row-reverse;justify-content: flex-end;
}
.flex-row-reverse-end-end {align-items: flex-end;display: flex;flex-direction: row-reverse;justify-content: flex-end;
}
.flex-row-reverse-end {align-items: center;display: flex;flex-direction: row-reverse;justify-content: flex-end;
}
.flex-row-reverse-end-baseline {align-items: baseline;display: flex;flex-direction: row-reverse;justify-content: flex-end;
}
.flex-row-reverse-end-stretch {align-items: stretch;display: flex;flex-direction: row-reverse;justify-content: flex-end;
}
.flex-row-reverse-center-start {align-items: flex-start;display: flex;flex-direction: row-reverse;justify-content: center;
}
.flex-row-reverse-center-end {align-items: flex-end;display: flex;flex-direction: row-reverse;justify-content: center;
}
.flex-row-reverse-center {align-items: center;display: flex;flex-direction: row-reverse;justify-content: center;
}
.flex-row-reverse-center-baseline {align-items: baseline;display: flex;flex-direction: row-reverse;justify-content: center;
}
.flex-row-reverse-center-stretch {align-items: stretch;display: flex;flex-direction: row-reverse;justify-content: center;
}
.flex-row-reverse-between-start {align-items: flex-start;display: flex;flex-direction: row-reverse;justify-content: space-between;
}
.flex-row-reverse-between-end {align-items: flex-end;display: flex;flex-direction: row-reverse;justify-content: space-between;
}
.flex-row-reverse-between {align-items: center;display: flex;flex-direction: row-reverse;justify-content: space-between;
}
.flex-row-reverse-between-baseline {align-items: baseline;display: flex;flex-direction: row-reverse;justify-content: space-between;
}
.flex-row-reverse-between-stretch {align-items: stretch;display: flex;flex-direction: row-reverse;justify-content: space-between;
}
.flex-row-reverse-around-start {align-items: flex-start;display: flex;flex-direction: row-reverse;justify-content: space-around;
}
.flex-row-reverse-around-end {align-items: flex-end;display: flex;flex-direction: row-reverse;justify-content: space-around;
}
.flex-row-reverse-around {align-items: center;display: flex;flex-direction: row-reverse;justify-content: space-around;
}
.flex-row-reverse-around-baseline {align-items: baseline;display: flex;flex-direction: row-reverse;justify-content: space-around;
}
.flex-row-reverse-around-stretch {align-items: stretch;display: flex;flex-direction: row-reverse;justify-content: space-around;
}
.flex-y-start-start {align-items: flex-start;display: flex;flex-direction: column;justify-content: flex-start;
}
.flex-y-start-end {align-items: flex-end;display: flex;flex-direction: column;justify-content: flex-start;
}
.flex-y-start {align-items: center;display: flex;flex-direction: column;justify-content: flex-start;
}
.flex-y-start-baseline {align-items: baseline;display: flex;flex-direction: column;justify-content: flex-start;
}
.flex-y-start-stretch {align-items: stretch;display: flex;flex-direction: column;justify-content: flex-start;
}
.flex-y-end-start {align-items: flex-start;display: flex;flex-direction: column;justify-content: flex-end;
}
.flex-y-end-end {align-items: flex-end;display: flex;flex-direction: column;justify-content: flex-end;
}
.flex-y-end {align-items: center;display: flex;flex-direction: column;justify-content: flex-end;
}
.flex-y-end-baseline {align-items: baseline;display: flex;flex-direction: column;justify-content: flex-end;
}
.flex-y-end-stretch {align-items: stretch;display: flex;flex-direction: column;justify-content: flex-end;
}
.flex-y-center-start {align-items: flex-start;display: flex;flex-direction: column;justify-content: center;
}
.flex-y-center-end {align-items: flex-end;display: flex;flex-direction: column;justify-content: center;
}
.flex-y-center {align-items: center;display: flex;flex-direction: column;justify-content: center;
}
.flex-y-center-baseline {align-items: baseline;display: flex;flex-direction: column;justify-content: center;
}
.flex-y-center-stretch {align-items: stretch;display: flex;flex-direction: column;justify-content: center;
}
.flex-y-between-start {align-items: flex-start;display: flex;flex-direction: column;justify-content: space-between;
}
.flex-y-between-end {align-items: flex-end;display: flex;flex-direction: column;justify-content: space-between;
}
.flex-y-between {align-items: center;display: flex;flex-direction: column;justify-content: space-between;
}
.flex-y-between-baseline {align-items: baseline;display: flex;flex-direction: column;justify-content: space-between;
}
.flex-y-between-stretch {align-items: stretch;display: flex;flex-direction: column;justify-content: space-between;
}
.flex-y-around-start {align-items: flex-start;display: flex;flex-direction: column;justify-content: space-around;
}
.flex-y-around-end {align-items: flex-end;display: flex;flex-direction: column;justify-content: space-around;
}
.flex-y-around {align-items: center;display: flex;flex-direction: column;justify-content: space-around;
}
.flex-y-around-baseline {align-items: baseline;display: flex;flex-direction: column;justify-content: space-around;
}
.flex-y-around-stretch {align-items: stretch;display: flex;flex-direction: column;justify-content: space-around;
}
.flex-column-reverse-start-start {align-items: flex-start;display: flex;flex-direction: column-reverse;justify-content: flex-start;
}
.flex-column-reverse-start-end {align-items: flex-end;display: flex;flex-direction: column-reverse;justify-content: flex-start;
}
.flex-column-reverse-start {align-items: center;display: flex;flex-direction: column-reverse;justify-content: flex-start;
}
.flex-column-reverse-start-baseline {align-items: baseline;display: flex;flex-direction: column-reverse;justify-content: flex-start;
}
.flex-column-reverse-start-stretch {align-items: stretch;display: flex;flex-direction: column-reverse;justify-content: flex-start;
}
.flex-column-reverse-end-start {align-items: flex-start;display: flex;flex-direction: column-reverse;justify-content: flex-end;
}
.flex-column-reverse-end-end {align-items: flex-end;display: flex;flex-direction: column-reverse;justify-content: flex-end;
}
.flex-column-reverse-end {align-items: center;display: flex;flex-direction: column-reverse;justify-content: flex-end;
}
.flex-column-reverse-end-baseline {align-items: baseline;display: flex;flex-direction: column-reverse;justify-content: flex-end;
}
.flex-column-reverse-end-stretch {align-items: stretch;display: flex;flex-direction: column-reverse;justify-content: flex-end;
}
.flex-column-reverse-center-start {align-items: flex-start;display: flex;flex-direction: column-reverse;justify-content: center;
}
.flex-column-reverse-center-end {align-items: flex-end;display: flex;flex-direction: column-reverse;justify-content: center;
}
.flex-column-reverse-center {align-items: center;display: flex;flex-direction: column-reverse;justify-content: center;
}
.flex-column-reverse-center-baseline {align-items: baseline;display: flex;flex-direction: column-reverse;justify-content: center;
}
.flex-column-reverse-center-stretch {align-items: stretch;display: flex;flex-direction: column-reverse;justify-content: center;
}
.flex-column-reverse-between-start {align-items: flex-start;display: flex;flex-direction: column-reverse;justify-content: space-between;
}
.flex-column-reverse-between-end {align-items: flex-end;display: flex;flex-direction: column-reverse;justify-content: space-between;
}
.flex-column-reverse-between {align-items: center;display: flex;flex-direction: column-reverse;justify-content: space-between;
}
.flex-column-reverse-between-baseline {align-items: baseline;display: flex;flex-direction: column-reverse;justify-content: space-between;
}
.flex-column-reverse-between-stretch {align-items: stretch;display: flex;flex-direction: column-reverse;justify-content: space-between;
}
.flex-column-reverse-around-start {align-items: flex-start;display: flex;flex-direction: column-reverse;justify-content: space-around;
}
.flex-column-reverse-around-end {align-items: flex-end;display: flex;flex-direction: column-reverse;justify-content: space-around;
}
.flex-column-reverse-around {align-items: center;display: flex;flex-direction: column-reverse;justify-content: space-around;
}
.flex-column-reverse-around-baseline {align-items: baseline;display: flex;flex-direction: column-reverse;justify-content: space-around;
}
.flex-column-reverse-around-stretch {align-items: stretch;display: flex;flex-direction: column-reverse;justify-content: space-around;
}

http://www.ppmy.cn/devtools/135556.html

相关文章

数据挖掘英语及概念

分类 classify 上涨或跌 回归 regression 描述具体数值 分类模型评估 1.混淆(误差)矩阵 confusion matrix 2.ROC曲线 receiver operating characteristic curve 接收者操作特征曲线 3.AUC面积 area under curve ROC曲线下与坐标轴围成的面积&#x…

安宝特分享 | 如何利用AR技术革新医疗实践:从远程急救到多学科协作

AR技术在国内外医院的应用 在现代医疗环境中,患者面临的挑战依然严峻:看病难、看病远、看病急。这些问题不仅影响了患者的治疗效果,也让医务工作者倍感压力。幸运的是,随着增强现实(AR)技术的发展&#xf…

【NodeJS】Node.js是什么?能做什么?

👉博主介绍: 博主从事应用安全和大数据领域,有8年研发经验,5年面试官经验,Java技术专家,WEB架构师,阿里云专家博主,华为云云享专家,51CTO 专家博主 ⛪️ 个人社区:个人社区 💞 个人主页:个人主页 🙉 专栏地址: ✅ Java 中级 🙉八股文专题:剑指大厂,手撕 J…

HarmonyOs鸿蒙开发实战(10)=>状态管理-对象数组的属性数据变更刷新UI,基于@Observed 和@ObjectLink装饰器

1.条件:基于HarmonyOs5.0.0版本. 2.功能要求:横向列表中每个景点的名称(eg: 第二项 “灵隐寺” ), 在通过天气接口拿到对应天气后,拼接到名称后面 > 变成(“灵隐寺” 天气)) 3.老规矩先看…

Spring Boot 整合 Minio

一、导入依赖 <!-- MinIO 客户端 --> <dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.5.7</version> </dependency><!-- OkHttp 是一个高效的网络库 --> <dependency>…

mysql 的乐观锁和 mvcc 是一回事吗

MySQL 的乐观锁和 MVCC&#xff08;多版本并发控制&#xff09;是两个不同的概念&#xff0c;尽管它们都涉及到并发控制和数据的一致性&#xff0c;但在设计目的和实现方式上存在本质区别。 1. 乐观锁 概念 乐观锁是一种用于解决并发更新冲突的控制机制。它假设数据在大部分情况…

【知识堂】奇点

“奇点”在不同领域有不同的含义。以下是几个常见的定义&#xff1a; 1. 数学中的奇点 在数学中&#xff0c;“奇点”通常指的是一个函数、曲线或空间中表现出不正常行为的点。在更详细的层面&#xff0c;奇点是指某个数学对象在该点附近无法用常规的数学工具来描述或者解析。…

【一句话经验】亚马逊云EC2 ubuntu24.04.1开启ROOT登录Permission denied (publickey)

按照常规的方法SSH登录会一直报错&#xff1a; Permission denied (publickey) 因为亚马逊云的默认配置不是在/etc/ssh/sshd_config&#xff0c;而是在引入的文件里了&#xff0c;所以在instance控制台输入这行命令来解除登录限制&#xff1a; sudo sed -i s/^PasswordAuthe…