当前位置: 首页 > article >正文

CSS - 妙用Sass

官方文档:https://www.sass.hk/docs/

1.例1:

@each $theme in $themeList {
  $themeKey: map-get($theme, 'key');
  @media screen and (weex-theme: $themeKey) {
    .btnText {
      max-width: 150px;
      @include font(map-get($theme, 'medFont'),map-get($theme, 'subFontSize'),400);
      @include ellipsis(2);
      color: map-get($theme, 'whiteColor');
      text-align: center;
    }
  }
}
/**
@each $theme in $themeList:
这是一个循环语句,遍历$themeList中的每个主题。
$themeList通常是一个包含多个主题的列表,每个主题是一个映射(map)。

$themeKey: map-get($theme, 'key'):
从当前主题映射中获取键值为'key'的值,并将其赋值给$themeKey。
map-get是Sass中的一个函数,用于从映射中获取值。

@media screen and (weex-theme: $themeKey):
这是一个媒体查询,用于根据不同的主题键值应用不同的样式。
weex-theme是一个自定义的媒体查询特性,用于在Weex中切换主
*/
  • 【逐步分析】
    xx组件:
<style lang="scss" scoped>
@import './config.scss';

@each $theme in $themeList {
  $themeKey: map-get($theme, 'key');
  @media screen and (weex-theme: $themeKey) {
    .btnText {
      max-width: 150px;
      @include font(map-get($theme, 'medFont'),map-get($theme, 'subFontSize'),400);
      @include ellipsis(2);
      color: map-get($theme, 'whiteColor');
      text-align: center;
    }
  }
}
</style>

config.scss:

@charset "UTF-8";

@import '../../../css/uiStandard/scss/default.scss';
$themeList: $mideaO100, $default;

default.scss:

@charset "UTF-8";
$default:(
  key: 'default',
  bigBtnHeight: 92px,
);

http://www.kler.cn/a/570033.html

相关文章:

  • shell脚本编程实践第6天
  • 高性能采集服务上线回顾
  • React 各模块相关全面面试及答案解析
  • 毓恬冠佳即将登陆资本市场,深耕汽车天窗领域,引领行业创新发展
  • [MySQL初阶]MySQL(1)MySQL的理解、库的操作、表的操作
  • MySQL深分页如何优化?
  • IDEA 2025最新版2024.3.3软件安装、插件安装、语言设置
  • c语言中return 数字代表的含义
  • 探秘基带算法:从原理到5G时代的通信变革【一】引言
  • 第三百七十二节 JavaFX教程 - JavaFX HTMLEditor
  • 【HDLbits--FSM续(二)】
  • 搭建iOS逆向开发环境 (下) - 越狱设备与高级工具配置
  • 蓝桥杯4T平台(串口控制LD状态)
  • 【Java项目】基于vue的地方美食分享系统
  • Spring配置文件
  • iPhone 镜像 连接错误
  • 2024 ChatGPT大模型技术场景与商业应用视频精讲合集(45课).zip
  • 51单片机课综合项目
  • 京准电钟:NTP校时服务器于安防监控系统应用方案
  • K8S学习之基础五:k8s中node节点亲和性