scss 全局变量维护

文件 src/scss/element-ui/element-variables.scss

  1. /* 改变主题色变量 */
  2. /* 主色 */
  3. $--color-primary: #1dc779;
  4. /* 辅助色 */
  5. $--color-success: #66c23b;
  6. $--color-warning: #ffb302;
  7. $--color-danger: #f56c6c;
  8. /* 中性色 */
  9. $--color-text-primary: #20232a;
  10. $--color-text-secondary: #818693;
  11. $--color-text-placeholder: #bac0cd;
  12. $--border-color-base: #d8dde3;
  13. /* Radio 单选框 */
  14. $--radio-checked-font-color: #20232a;
  15. $--radio-checked-icon-color: #419eff;
  16. $--radio-checked-input-border-color: #419eff;
  17. /* Checkbox 多选框 */
  18. $--checkbox-checked-background-color: #419eff;
  19. $--checkbox-checked-font-color: #20232a;
  20. /* 背景色 */
  21. $--background-color: #f3f4f7;
  22. $--color-white: #ffffff;
  23. /* 改变 icon 字体路径变量,必需 */
  24. $--font-path: '~element-ui/lib/theme-chalk/fonts';
  25. @import '~element-ui/packages/theme-chalk/src/index';
  26. // 自定义样式
  27. @import 'el-button';
  28. @import 'el-input';

注意先后顺序 变量 -> 饿了么theme样式包 -> 复写自定义组件样式

全局覆盖样式

按钮、输入框、Tab控件、卡片 需要单独文件维护
如:radio 按钮组 src/scss/element-ui/el-radio-group.scss

  1. .switch.el-radio-group {
  2. height: 40px;
  3. background: #cbcbde;
  4. border-radius: 8px;
  5. padding: 4px 5px 0px 5px;
  6. .el-radio-button.is-active {
  7. .el-radio-button__inner {
  8. background: #ffffff;
  9. box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.06);
  10. border-radius: 6px;
  11. height: 32px;
  12. border: 0px;
  13. font-size: 14px;
  14. font-family: PingFangSC-Semibold, PingFang SC;
  15. font-weight: 600;
  16. color: #17233e;
  17. line-height: 14px;
  18. }
  19. }
  20. .el-radio-button__inner {
  21. background: #cbcbde;
  22. height: 32px;
  23. border: 0px;
  24. font-size: 14px;
  25. font-family: PingFangSC-Regular, PingFang SC;
  26. font-weight: 400;
  27. color: #222e47;
  28. line-height: 14px;
  29. }
  30. .el-radio-button:first-child .el-radio-button__inner {
  31. border-left: 0px;
  32. }
  33. }