main.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div>
  3. <div class="container">
  4. <div class="title">
  5. <div class="redcolumn"></div>
  6. <div class="container-title">{{ title }}</div>
  7. </div>
  8. <div v-if="showBtn" class="container-foot" @click="open">
  9. <div v-show="show" style="height: 20px">
  10. <span><i class="el-icon-arrow-up" :style="styleIocup"/></span>
  11. </div>
  12. <div v-show="!show" style="height: 20px">
  13. <span><i class="el-icon-arrow-down"/></span>
  14. </div>
  15. </div>
  16. </div>
  17. <div
  18. class="basic-container"
  19. :style="styleName"
  20. :class="{ 'basic-container--block': block }"
  21. >
  22. <el-card class="basic-container__card" style="padding: 0;">
  23. <el-collapse-transition>
  24. <div v-show="show">
  25. <slot></slot>
  26. </div>
  27. </el-collapse-transition>
  28. </el-card>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. export default {
  34. name: 'basicContainer',
  35. data() {
  36. return {};
  37. },
  38. props: {
  39. radius: {
  40. type: [String, Number],
  41. default: 10
  42. },
  43. background: {
  44. type: String
  45. },
  46. block: {
  47. type: Boolean,
  48. default: false
  49. },
  50. showBtn: {
  51. type: Boolean,
  52. default: true
  53. },
  54. title: {
  55. type: String
  56. },
  57. show: {
  58. type: Boolean,
  59. default: true
  60. },
  61. styleIocup: {
  62. type: String,
  63. default: ''
  64. }
  65. },
  66. methods: {
  67. open() {
  68. this.show = !this.show;
  69. this.$emit('openClose', this.show);
  70. }
  71. },
  72. computed: {
  73. styleName() {
  74. return {
  75. borderRadius: this.setPx(this.radius),
  76. background: this.background
  77. };
  78. }
  79. }
  80. };
  81. </script>
  82. <style lang="scss" scoped>
  83. .container {
  84. display: flex;
  85. justify-content: space-between;
  86. margin-left: 10px;
  87. margin-right: 10px;
  88. background-color: inherit;
  89. height: 18px;
  90. // padding-bottom: 12px;
  91. vertical-align: middle;
  92. .title {
  93. display: flex;
  94. .redcolumn {
  95. width: 4px;
  96. height: 13px;
  97. background-color: #d6000f;
  98. margin: 3px 4px 0 0;
  99. }
  100. .container-title {
  101. font-size: 12px;
  102. line-height: 20px;
  103. font-family: PingFangSC-Semibold, PingFang SC;
  104. font-weight: 600;
  105. color: #323233;
  106. }
  107. }
  108. .container-foot {
  109. font-size: 16px;
  110. font-weight: 1000;
  111. }
  112. }
  113. .basic-container {
  114. padding: 5px 6px;
  115. box-sizing: border-box;
  116. &--block {
  117. height: 100%;
  118. .basic-container__card {
  119. height: 100%;
  120. }
  121. }
  122. ::v-deep .el-card .el-card__body {
  123. padding: 5px !important;
  124. }
  125. &__card {
  126. width: 100%;
  127. }
  128. &:first-child {
  129. padding-top: 6px;
  130. }
  131. }
  132. </style>