panel-no-title.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. s;
  36. </script>
  37. <style lang="less" scoped>
  38. .com-panel {
  39. border-left: 0.185vh solid rgba(255, 255, 255, 50%);
  40. &:before {
  41. content: " ";
  42. width: 0.37vh;
  43. height: 0.37vh;
  44. float: left;
  45. background: #fff;
  46. margin: 0.185vh 0.556vh 0vh 0.185vh;
  47. }
  48. &.no-title {
  49. border-left: 0vh;
  50. }
  51. &.no-title::before {
  52. display: none;
  53. }
  54. .panel-header {
  55. display: flex;
  56. font-size: @fontsize;
  57. padding-left: 1.4815vh;
  58. background: rgba(255, 255, 255, 10%);
  59. line-height: 2.963vh;
  60. margin-bottom: 1.481vh;
  61. .panel-title {
  62. color: rgba(255, 255, 255, 0.8);
  63. flex: 1 1 auto;
  64. .panel-icon {
  65. margin-right: 0.741vh;
  66. }
  67. }
  68. .panel-tools {
  69. flex: 0 0 auto;
  70. color: #fff;
  71. opacity: 0.3;
  72. padding: 0 0.741vh;
  73. font-size: @fontsize-s;
  74. letter-spacing: 0.093vh;
  75. }
  76. }
  77. .panel-body {
  78. padding-left: 1.111vh;
  79. color: rgba(255, 255, 255, 0.8);
  80. }
  81. &.no-title .panel-body {
  82. padding-left: 0vh;
  83. }
  84. }
  85. </style>