SectionTitle.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div class="adm-section-title" :class="{ 'is-plain': plain }">
  3. <span class="adm-section-title__bar"></span>
  4. <span class="adm-section-title__text">{{ title }}</span>
  5. <span v-if="desc" class="adm-section-title__desc">{{ desc }}</span>
  6. <span class="adm-section-title__extra">
  7. <slot />
  8. </span>
  9. </div>
  10. </template>
  11. <script>
  12. /**
  13. * SectionTitle —— 区块小标题
  14. *
  15. * 设计目的:卡片内「基础信息 / 高级配置 / 操作日志」等分区,
  16. * 目前各页用 el-divider、裸 div 或 h3 混写,缩进与字号不统一。
  17. *
  18. * 用法:
  19. * <SectionTitle title="基础信息" desc="必填项" />
  20. * <SectionTitle title="操作日志"><el-button size="mini">导出</el-button></SectionTitle>
  21. */
  22. export default {
  23. name: 'SectionTitle',
  24. props: {
  25. /** 区块标题 */
  26. title: { type: String, required: true },
  27. /** 右侧灰色补充说明 */
  28. desc: { type: String, default: '' },
  29. /** 无装饰竖线的纯文本样式 */
  30. plain: { type: Boolean, default: false }
  31. }
  32. }
  33. </script>
  34. <style scoped>
  35. .adm-section-title {
  36. display: flex;
  37. align-items: center;
  38. gap: 8px;
  39. margin: 4px 0 12px;
  40. }
  41. .adm-section-title__bar {
  42. flex: 0 0 auto;
  43. width: 3px;
  44. height: 14px;
  45. border-radius: 2px;
  46. background: var(--adm-primary);
  47. }
  48. .adm-section-title.is-plain .adm-section-title__bar {
  49. display: none;
  50. }
  51. .adm-section-title__text {
  52. font-size: 14px;
  53. font-weight: 600;
  54. line-height: 22px;
  55. color: #262626;
  56. }
  57. .adm-section-title__desc {
  58. font-size: 12px;
  59. color: #8c8c8c;
  60. }
  61. .adm-section-title__extra {
  62. margin-left: auto;
  63. display: flex;
  64. align-items: center;
  65. gap: 8px;
  66. }
  67. </style>