2018-07-16 22:22:55 +08:00
|
|
|
<template>
|
2018-07-18 08:30:51 +08:00
|
|
|
<div class="container-component" ref="container">
|
2018-07-16 22:22:55 +08:00
|
|
|
<!-- [card] 卡片容器 -->
|
2018-07-21 14:13:25 +08:00
|
|
|
<d2-container-card v-if="type === 'card' && !scroll">
|
2018-07-16 22:22:55 +08:00
|
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
|
|
|
|
<slot/>
|
2018-07-21 14:13:25 +08:00
|
|
|
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
|
|
|
|
</d2-container-card>
|
2018-07-21 13:27:35 +08:00
|
|
|
<!-- [ghost] 隐形容器 -->
|
|
|
|
|
<d2-container-ghost v-if="type === 'ghost' && !scroll">
|
2018-07-21 12:44:47 +08:00
|
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
2018-07-16 22:22:55 +08:00
|
|
|
<slot/>
|
2018-07-21 12:44:47 +08:00
|
|
|
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
|
|
|
|
</d2-container-ghost>
|
2018-07-21 13:27:35 +08:00
|
|
|
<!-- [ghost] 隐形容器 滚动优化 -->
|
|
|
|
|
<d2-container-ghost-bs v-if="type === 'ghost' && scroll">
|
|
|
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
|
|
|
|
<slot/>
|
|
|
|
|
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
|
|
|
|
</d2-container-ghost-bs>
|
2018-07-16 22:22:55 +08:00
|
|
|
<!-- [container-full] 填充 -->
|
|
|
|
|
<d2-container-full v-if="type === 'full' && !scroll">
|
|
|
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
|
|
|
|
<slot/>
|
|
|
|
|
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
|
|
|
|
</d2-container-full>
|
|
|
|
|
<!-- [container-full-bs] 填充 滚动优化 -->
|
|
|
|
|
<d2-container-full-bs v-if="type === 'full' && scroll">
|
|
|
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
|
|
|
|
<slot/>
|
|
|
|
|
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
|
|
|
|
</d2-container-full-bs>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
// 组件
|
|
|
|
|
import d2ContainerFull from './components/d2-container-full.vue'
|
|
|
|
|
import d2ContainerFullBs from './components/d2-container-full-bs.vue'
|
2018-07-21 12:44:47 +08:00
|
|
|
import d2ContainerGhost from './components/d2-container-ghost.vue'
|
2018-07-21 13:27:35 +08:00
|
|
|
import d2ContainerGhostBs from './components/d2-container-ghost-bs.vue'
|
2018-07-21 14:13:25 +08:00
|
|
|
import d2ContainerCard from './components/d2-container-card.vue'
|
2018-07-16 22:22:55 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'd2-container',
|
|
|
|
|
props: {
|
|
|
|
|
// 容器样式
|
|
|
|
|
type: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
2018-07-18 08:30:51 +08:00
|
|
|
default: 'full'
|
2018-07-16 22:22:55 +08:00
|
|
|
},
|
|
|
|
|
// 滚动优化
|
|
|
|
|
scroll: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
'd2-container-full': d2ContainerFull,
|
2018-07-21 12:44:47 +08:00
|
|
|
'd2-container-full-bs': d2ContainerFullBs,
|
2018-07-21 13:27:35 +08:00
|
|
|
'd2-container-ghost': d2ContainerGhost,
|
2018-07-21 14:13:25 +08:00
|
|
|
'd2-container-ghost-bs': d2ContainerGhostBs,
|
|
|
|
|
'd2-container-card': d2ContainerCard
|
2018-07-16 22:22:55 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|