first
This commit is contained in:
8
packages/container/index.js
Normal file
8
packages/container/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
import Container from './src/main';
|
||||
|
||||
/* istanbul ignore next */
|
||||
Container.install = function(Vue) {
|
||||
Vue.component(Container.name, Container);
|
||||
};
|
||||
|
||||
export default Container;
|
33
packages/container/src/main.vue
Normal file
33
packages/container/src/main.vue
Normal file
@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<section class="el-container" :class="{ 'is-vertical': isVertical }">
|
||||
<slot></slot>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ElContainer',
|
||||
|
||||
componentName: 'ElContainer',
|
||||
|
||||
props: {
|
||||
direction: String
|
||||
},
|
||||
|
||||
computed: {
|
||||
isVertical() {
|
||||
if (this.direction === 'vertical') {
|
||||
return true;
|
||||
} else if (this.direction === 'horizontal') {
|
||||
return false;
|
||||
}
|
||||
return this.$slots && this.$slots.default
|
||||
? this.$slots.default.some(vnode => {
|
||||
const tag = vnode.componentOptions && vnode.componentOptions.tag;
|
||||
return tag === 'el-header' || tag === 'el-footer';
|
||||
})
|
||||
: false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user