typography.scss 2.85 KB
// 字体系统
$font-family-primary: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

// 文字层级系统
.text-h1 {
  font-family: $font-family-primary;
  font-size: 24px;
  font-weight: 600;
  line-height: 40px;
  letter-spacing: 0;
  color: var(--el-text-color-primary);
}

.text-h2 {
  font-family: $font-family-primary;
  font-size: 20px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: 0;
  color: var(--el-text-color-primary);
}

.text-h3 {
  font-family: $font-family-primary;
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: 0;
  color: var(--el-text-color-primary);
}

.text-h4 {
  font-family: $font-family-primary;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--el-text-color-primary);
}

.text-body {
  font-family: $font-family-primary;
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
  letter-spacing: 0;
  color: var(--el-text-color-primary);
}

.text-caption {
  font-family: $font-family-primary;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0;
  color: var(--el-text-color-regular);
}

.text-small {
  font-family: $font-family-primary;
  font-size: 11px;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: 0;
  color: var(--el-text-color-secondary);
}

// 文字工具类
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-bold { font-weight: 600; }
.text-medium { font-weight: 500; }
.text-normal { font-weight: 400; }

.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-ellipsis-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

// 全局文字样式重置
* {
  font-family: $font-family-primary;
}

// 标题样式
h1, .h1 {
  @extend .text-h1;
}

h2, .h2 {
  @extend .text-h2;
}

h3, .h3 {
  @extend .text-h3;
}

h4, .h4 {
  @extend .text-h4;
}

// 段落和文本样式
p, .p {
  @extend .text-body;
  margin: 0 0 16px 0;
}

// 小文本样式
small, .small {
  @extend .text-caption;
}

// 标签样式
label, .label {
  @extend .text-caption;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}

// 按钮文字样式
button, .btn {
  font-family: $font-family-primary;
  font-weight: 500;
  letter-spacing: 0;
}

// 输入框文字样式
input, textarea, select {
  font-family: $font-family-primary;
  font-size: 14px;
  line-height: 22px;
  letter-spacing: 0;
}

// 表格文字样式
table {
  font-family: $font-family-primary;
  
  th {
    font-weight: 500;
    font-size: 12px;
    line-height: 18px;
    letter-spacing: 0;
  }
  
  td {
    font-size: 12px;
    line-height: 18px;
    letter-spacing: 0;
  }
}