panel-no-title.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div class="com-panel" :class="{ 'no-title': !hasTitle }">
  3. <div v-if="hasTitle" class="panel-header">
  4. <div class="panel-title">
  5. <i v-if="hasIcon" class="panel-icon" :class="icon"></i>
  6. {{ title }}
  7. </div>
  8. <div class="panel-tools">{{ subTitle }}</div>
  9. </div>
  10. <div class="panel-body">
  11. <slot></slot>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. name: "com-panel",
  18. componentName: "com-panel",
  19. props: {
  20. title: String,
  21. icon: String,
  22. subTitle: String,
  23. },
  24. computed: {
  25. hasTitle() {
  26. if (this.title) return true;
  27. return false;
  28. },
  29. hasIcon() {
  30. if (this.icon) return true;
  31. return false;
  32. },
  33. },
  34. };
  35. </script>
  36. <style lang="less" scoped>
  37. .com-panel {
  38. border-left: 0.185vh solid rgba(255, 255, 255, 50%);
  39. &:before {
  40. content: " ";
  41. width: 0.37vh;
  42. height: 0.37vh;
  43. float: left;
  44. background: #fff;
  45. margin: 0.185vh 0.556vh 0vh 0.185vh;
  46. }
  47. &.no-title {
  48. border-left: 0vh;
  49. }
  50. &.no-title::before {
  51. display: none;
  52. }
  53. .panel-header {
  54. display: flex;
  55. font-size: @fontsize;
  56. padding-left: 1.4815vh;
  57. background: rgba(255, 255, 255, 10%);
  58. line-height: 2.963vh;
  59. margin-bottom: 1.481vh;
  60. .panel-title {
  61. color: rgba(255, 255, 255, 0.8);
  62. flex: 1 1 auto;
  63. .panel-icon {
  64. margin-right: 0.741vh;
  65. }
  66. }
  67. .panel-tools {
  68. flex: 0 0 auto;
  69. color: #fff;
  70. opacity: 0.3;
  71. padding: 0 0.741vh;
  72. font-size: @fontsize-s;
  73. letter-spacing: 0.093vh;
  74. }
  75. }
  76. .panel-body {
  77. padding-left: 1.111vh;
  78. color: rgba(255, 255, 255, 0.8);
  79. }
  80. &.no-title .panel-body {
  81. padding-left: 0vh;
  82. }
  83. }
  84. </style>