Former-commit-id: e0a5e4a4954423d50cdaa57f5fc8057a8e3ef215 [formerly e0a5e4a4954423d50cdaa57f5fc8057a8e3ef215 [formerly e0a5e4a4954423d50cdaa57f5fc8057a8e3ef215 [formerly e0a5e4a4954423d50cdaa57f5fc8057a8e3ef215 [formerly 1fc51a4e117247b0023f0e25927608f4f9281f67 [formerly 9ebd9ea8b0b21cae36b356753fe9d50003145af2]]]]]
Former-commit-id: 1c4e3edd31787a549cedfa4c1e2fd9ba83b6a89e
Former-commit-id: 4ea6de6f61f38ad46e18e0f601fac6d7505bc466
Former-commit-id: 2bc2130cc0f60ae8eb85b5a7f492d60a754f0a9f [formerly f80a034694a85866c30c0b0fb0fc9f5267fcd56d]
Former-commit-id: 77bfe482382b14bd6e320becc9b671edcefd0727
Former-commit-id: a2e7ffd516054bb3603df2bae1f3dec360fdf737
Former-commit-id: 022d5c397a13dbc64e12ce60ece22a5a0a08b943
Former-commit-id: 66714b48a3530aa104bcca4b7540fecb05a8d3ff
Former-commit-id: 43ff1e93723f72f632212a61c9d9f779cfceb7a3
This commit is contained in:
liyang
2018-07-21 14:13:25 +08:00
parent 852b39b28c
commit a16c62e5a4
16 changed files with 71 additions and 412 deletions

View File

@@ -0,0 +1,21 @@
<template>
<div class="d2-container-card">
<div v-if="$slots.header" class="d2-container-card__header" ref="header">
<slot name="header"/>
</div>
<div class="d2-container-card__body">
<div class="d2-container-card__body-inner">
<slot/>
</div>
</div>
<div v-if="$slots.footer" class="d2-container-card__footer" ref="footer">
<slot name="footer"/>
</div>
</div>
</template>
<script>
export default {
name: 'd2-container-card'
}
</script>

View File

@@ -1,10 +1,11 @@
<template>
<div class="container-component" ref="container">
<!-- [card] 卡片容器 -->
<el-card v-if="type === 'card'" shadow="never" class="d2-container-card d2-mr">
<d2-container-card v-if="type === 'card' && !scroll">
<slot v-if="$slots.header" name="header" slot="header"/>
<slot/>
</el-card>
<slot v-if="$slots.footer" name="footer" slot="footer"/>
</d2-container-card>
<!-- [ghost] 隐形容器 -->
<d2-container-ghost v-if="type === 'ghost' && !scroll">
<slot v-if="$slots.header" name="header" slot="header"/>
@@ -33,13 +34,12 @@
</template>
<script>
// 插件
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'
import d2ContainerGhostBs from './components/d2-container-ghost-bs.vue'
import d2ContainerCard from './components/d2-container-card.vue'
export default {
name: 'd2-container',
props: {
@@ -60,38 +60,8 @@ export default {
'd2-container-full': d2ContainerFull,
'd2-container-full-bs': d2ContainerFullBs,
'd2-container-ghost': d2ContainerGhost,
'd2-container-ghost-bs': d2ContainerGhostBs
},
data () {
return {
BS: null
}
},
mounted () {
if (this.type === 'card') {
this.scrollInit()
}
},
beforeDestroy () {
if (this.type === 'card') {
this.scrollDestroy()
}
},
methods: {
scrollInit () {
this.BS = new BScroll(this.$refs.container, {
mouseWheel: true,
scrollbar: {
fade: true,
interactive: false
}
})
},
scrollDestroy () {
if (this.BS) {
this.BS.destroy()
}
}
'd2-container-ghost-bs': d2ContainerGhostBs,
'd2-container-card': d2ContainerCard
}
}
</script>