no message

Former-commit-id: d7106d025703b65fd309a8feaf399c3675babfc4
Former-commit-id: 227ac204f64b9799296d9b65e80e963ec90f5320
Former-commit-id: 342e6cbb22bfeea72cffdf552b42edb8621e084f
This commit is contained in:
liyang
2018-06-04 14:43:47 +08:00
parent bbcabd409d
commit 3b09d88200
7 changed files with 32 additions and 22 deletions

View File

@@ -0,0 +1,67 @@
<template>
<div class="dd-card-full" :style="cardStyle">
<div v-if="$slots.header" class="dd-card-full__header" ref="header">
<slot name="header"></slot>
</div>
<div class="dd-card-full__body" :style="bodyStyle">
<slot></slot>
</div>
<div v-if="$slots.footer" class="dd-card-full__footer" ref="footer">
<slot name="footer"></slot>
</div>
</div>
</template>
<script>
export default {
props: {
// 定位 上 右 下 左
top: {
type: Number,
required: false,
default: 0
},
right: {
type: Number,
required: false,
default: 0
},
bottom: {
type: Number,
required: false,
default: 0
},
left: {
type: Number,
required: false,
default: 0
}
},
data () {
return {
headerHeight: 0,
footerHeight: 0
}
},
mounted () {
this.headerHeight = this.$slots.header ? this.$refs.header.offsetHeight : 0
this.footerHeight = this.$slots.footer ? this.$refs.footer.offsetHeight : 0
},
computed: {
cardStyle () {
return {
top: `${this.top}px`,
right: `${this.right}px`,
bottom: `${this.bottom}px`,
left: `${this.left}px`
}
},
bodyStyle () {
return {
top: `${this.headerHeight}px`,
bottom: `${this.footerHeight}px`
}
}
}
}
</script>