main.vue 754 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <section class="el-container" :class="{ 'is-vertical': isVertical }">
  3. <slot></slot>
  4. </section>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'ElContainer',
  9. componentName: 'ElContainer',
  10. props: {
  11. direction: String
  12. },
  13. computed: {
  14. isVertical() {
  15. if (this.direction === 'vertical') {
  16. return true;
  17. } else if (this.direction === 'horizontal') {
  18. return false;
  19. }
  20. return this.$slots && this.$slots.default
  21. ? this.$slots.default.some(vnode => {
  22. const tag = vnode.componentOptions && vnode.componentOptions.tag;
  23. return tag === 'el-header' || tag === 'el-footer';
  24. })
  25. : false;
  26. }
  27. }
  28. };
  29. </script>