优化布局组件

Former-commit-id: 65e8be3a3e4781706d13890b3ab1c4161da5eb48 [formerly 6ee3fa6bda1f3dfeac14e1bde981df71453a4cf4] [formerly 65e8be3a3e4781706d13890b3ab1c4161da5eb48 [formerly 6ee3fa6bda1f3dfeac14e1bde981df71453a4cf4] [formerly 65e8be3a3e4781706d13890b3ab1c4161da5eb48 [formerly 6ee3fa6bda1f3dfeac14e1bde981df71453a4cf4] [formerly 6ee3fa6bda1f3dfeac14e1bde981df71453a4cf4 [formerly 296675d3e38d15024de3440733209ad8a968f519 [formerly 593f575acfed4f454810508bf2fdd590ffd096d4]]]]]
Former-commit-id: 660493d5ad50e8f690d130df0749e5395ac84fa0
Former-commit-id: c00a4141fc9a1f187d9b1a1c1f63f975c0c59e0c
Former-commit-id: 4c4331890a61259ada6be7840dda6747628493bc [formerly 2bab08dc4546c14790740aa245062d30fa1542fa]
Former-commit-id: 10a14d376c22b186870e745f089cfce167c3e9d2
Former-commit-id: 6552bbc1565c9fb5e08c71c60ad9330f4f067def
Former-commit-id: 7a3edf22710ba4c82278abe86b69eb8004484e05
Former-commit-id: bdf4a9137b275c53b8ae6268de6e3d09aee61525
Former-commit-id: 5f28a623c7fa1f64e31d4536b206d0613207d982
This commit is contained in:
liyang
2018-07-21 12:44:47 +08:00
parent 5179475d05
commit 4ba23d7b94
19 changed files with 90 additions and 509 deletions

View File

@@ -0,0 +1,13 @@
<template>
<div class="d2-container-ghost">
<div v-if="$slots.header" class="d2-container-ghost__header" ref="header">
<slot name="header"/>
</div>
<div class="d2-container-ghost__body">
<slot/>
</div>
<div v-if="$slots.footer" class="d2-container-ghost__footer" ref="footer">
<slot name="footer"/>
</div>
</div>
</template>

View File

@@ -6,12 +6,11 @@
<slot/>
</el-card>
<!-- [ghost] 隐形的容器 -->
<div v-if="type === 'ghost'" class="d2-container-ghost">
<el-card v-if="$slots.header" shadow="never" class="d2-container-ghost-header">
<slot name="header"/>
</el-card>
<d2-container-ghost v-if="type === 'ghost'">
<slot v-if="$slots.header" name="header" slot="header"/>
<slot/>
</div>
<slot v-if="$slots.footer" name="footer" slot="footer"/>
</d2-container-ghost>
<!-- [container-full] 填充 -->
<d2-container-full v-if="type === 'full' && !scroll">
<slot v-if="$slots.header" name="header" slot="header"/>
@@ -33,6 +32,7 @@ import BScroll from 'better-scroll'
// 组件
import d2ContainerFull from './components/d2-container-full.vue'
import d2ContainerFullBs from './components/d2-container-full-bs.vue'
import d2ContainerGhost from './components/d2-container-ghost.vue'
export default {
name: 'd2-container',
props: {
@@ -51,7 +51,8 @@ export default {
},
components: {
'd2-container-full': d2ContainerFull,
'd2-container-full-bs': d2ContainerFullBs
'd2-container-full-bs': d2ContainerFullBs,
'd2-container-ghost': d2ContainerGhost
},
data () {
return {
@@ -59,12 +60,12 @@ export default {
}
},
mounted () {
if (this.type === 'card' || this.type === 'ghost') {
if (this.type === 'card') {
this.scrollInit()
}
},
beforeDestroy () {
if (this.type === 'card' || this.type === 'ghost') {
if (this.type === 'card') {
this.scrollDestroy()
}
},