Layout
需求演示
- 布局一
- 布局二
- 布局三
实现逻辑
- 在
layout组件中检测子组件是否含有sider组件 - 如果为
true那么flex-direction:row - 如果为
false那么为column方式排列
mounted(){
this.$children.forEach((vm)=>{
if (vm.$options.name === 'Sider') {
this.layoutClass.hasSider = true
}
})
}