main.vue 887 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div class="basic-container"
  3. :style="styleName"
  4. :class="{'basic-container--block':block}">
  5. <el-card class="basic-container__card">
  6. <slot></slot>
  7. </el-card>
  8. </div>
  9. </template>
  10. <script>
  11. export default {
  12. name: "basicContainer",
  13. props: {
  14. radius: {
  15. type: [String, Number],
  16. default: 10
  17. },
  18. background: {
  19. type: String
  20. },
  21. block: {
  22. type: Boolean,
  23. default: false
  24. }
  25. },
  26. computed: {
  27. styleName () {
  28. return {
  29. borderRadius: this.setPx(this.radius),
  30. background: this.background,
  31. }
  32. }
  33. }
  34. };
  35. </script>
  36. <style lang="scss">
  37. .basic-container {
  38. padding: 10px 6px;
  39. box-sizing: border-box;
  40. &--block {
  41. height: 100%;
  42. .basic-container__card {
  43. height: 100%;
  44. }
  45. }
  46. &__card {
  47. width: 100%;
  48. }
  49. &:first-child {
  50. padding-top: 0;
  51. }
  52. }
  53. </style>