UiSectionCard.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <script>
  2. export default {
  3. name: 'UiSectionCard',
  4. inheritAttrs: true,
  5. props: {
  6. title: {
  7. type: String,
  8. default: ''
  9. },
  10. shadow: {
  11. type: String,
  12. default: 'never'
  13. }
  14. }
  15. }
  16. </script>
  17. <template>
  18. <!-- 透传 Element Card 属性与组件事件;布局样式仅作用于当前卡片的直接子节点。 -->
  19. <el-card class="ng-ui-section-card" :shadow="shadow" v-bind="$attrs" v-on="$listeners">
  20. <template v-if="title || $slots.header || $scopedSlots.header" slot="header">
  21. <slot name="header">
  22. <h2 class="ng-ui-section-card-title">{{ title }}</h2>
  23. </slot>
  24. </template>
  25. <slot />
  26. </el-card>
  27. </template>
  28. <style lang="scss" scoped>
  29. .ng-ui-section-card {
  30. margin-bottom: 24px;
  31. border-radius: 8px;
  32. }
  33. .ng-ui-section-card-title {
  34. margin: 0;
  35. color: #202259;
  36. font-size: 16px;
  37. font-weight: 700;
  38. line-height: 1.5;
  39. }
  40. .ng-ui-section-card ::v-deep > .el-card__header {
  41. margin: 0 24px;
  42. padding: 22px 0 14px;
  43. }
  44. .ng-ui-section-card ::v-deep > .el-card__body {
  45. padding: 24px 24px 4px;
  46. }
  47. @media (max-width: 767px) {
  48. .ng-ui-section-card {
  49. margin-bottom: 24px;
  50. }
  51. .ng-ui-section-card ::v-deep > .el-card__header {
  52. margin: 0 16px;
  53. }
  54. .ng-ui-section-card ::v-deep > .el-card__body {
  55. padding: 20px 16px 0;
  56. }
  57. }
  58. </style>