2018-01-14 22:51:12 +08:00
|
|
|
<template>
|
2018-01-28 14:58:34 +08:00
|
|
|
<div class="container-component" :class="{responsive}">
|
2018-01-14 22:51:12 +08:00
|
|
|
<!-- [card] 卡片容器 -->
|
2018-06-09 22:39:05 +08:00
|
|
|
<el-card v-if="type === 'card'" class="d2-mr d2-mb">
|
2018-06-10 09:21:26 +08:00
|
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
|
|
|
|
<slot/>
|
2018-01-14 22:51:12 +08:00
|
|
|
</el-card>
|
|
|
|
|
<!-- [ghost] 隐形的容器 -->
|
2018-06-09 22:39:05 +08:00
|
|
|
<div v-if="type === 'ghost'" class="d2-mr d2-mb">
|
2018-06-10 09:21:26 +08:00
|
|
|
<slot name="header"/>
|
|
|
|
|
<slot/>
|
2018-01-14 22:51:12 +08:00
|
|
|
</div>
|
2018-06-04 14:43:47 +08:00
|
|
|
<!-- [container-full] 撑满 -->
|
2018-06-10 08:39:06 +08:00
|
|
|
<d2-container-full v-if="type === 'full'" :right="20" :bottom="0">
|
2018-06-10 09:21:26 +08:00
|
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
|
|
|
|
<slot/>
|
|
|
|
|
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
2018-06-10 08:39:06 +08:00
|
|
|
</d2-container-full>
|
2018-01-14 22:51:12 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
2018-06-10 08:39:06 +08:00
|
|
|
name: 'd2-container',
|
2018-01-14 22:51:12 +08:00
|
|
|
props: {
|
2018-01-28 14:58:34 +08:00
|
|
|
// 容器样式
|
2018-01-14 22:51:12 +08:00
|
|
|
type: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: 'card'
|
2018-01-28 14:58:34 +08:00
|
|
|
},
|
|
|
|
|
// 是否开启响应式尺寸变化
|
|
|
|
|
responsive: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false
|
2018-01-14 22:51:12 +08:00
|
|
|
}
|
2018-06-04 14:43:47 +08:00
|
|
|
},
|
|
|
|
|
components: {
|
2018-06-10 08:39:06 +08:00
|
|
|
'd2-container-full': () => import('../d2-container-full/index.vue')
|
2018-01-14 22:51:12 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2018-01-28 14:58:34 +08:00
|
|
|
|
|
|
|
|
<style lang="scss">
|
2018-03-09 19:16:04 +08:00
|
|
|
@import '~@/assets/style/public.scss';
|
2018-01-28 14:58:34 +08:00
|
|
|
.container-component {
|
2018-03-21 20:51:51 +08:00
|
|
|
// margin-right: 20px;
|
|
|
|
|
// margin-bottom: 20px;
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0px;
|
|
|
|
|
bottom: 0px;
|
|
|
|
|
left: 0px;
|
|
|
|
|
right: 0px;
|
|
|
|
|
// padding-right: $margin;
|
|
|
|
|
// padding-bottom: $margin;
|
|
|
|
|
overflow: auto;
|
2018-01-28 14:58:34 +08:00
|
|
|
}
|
|
|
|
|
@media (min-width: 576px) {
|
|
|
|
|
// 根据你的需要在这里添加样式
|
|
|
|
|
}
|
|
|
|
|
@media (min-width: 768px) {
|
|
|
|
|
// 根据你的需要在这里添加样式
|
|
|
|
|
}
|
|
|
|
|
@media (min-width: 992px) {
|
|
|
|
|
// 根据你的需要在这里添加样式
|
|
|
|
|
}
|
|
|
|
|
// 在大于1920分辨率的时候
|
|
|
|
|
@media (min-width: 1921px) {
|
|
|
|
|
.container-component.responsive {
|
|
|
|
|
margin: 0px auto;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
max-width: 1920px - 200px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|