2018-03-09 19:38:33 +08:00
|
|
|
<template>
|
2018-03-09 19:42:57 +08:00
|
|
|
<div class="dd-card-full" :style="cardStyle">
|
2018-03-09 19:38:33 +08:00
|
|
|
<div class="dd-card-full__header" ref="header">
|
|
|
|
|
<slot name="header"></slot>
|
|
|
|
|
</div>
|
2018-03-10 21:13:19 +08:00
|
|
|
<div class="dd-card-full__body" :style="bodyStyle">
|
2018-03-09 19:38:33 +08:00
|
|
|
<slot></slot>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
2018-03-09 19:42:57 +08:00
|
|
|
props: {
|
2018-03-09 20:39:16 +08:00
|
|
|
// 定位 上 右 下 左
|
2018-03-09 19:42:57 +08:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-03-10 21:13:19 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
headerHeight: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-03-09 19:38:33 +08:00
|
|
|
mounted () {
|
2018-03-10 21:13:19 +08:00
|
|
|
this.headerHeight = this.$refs.header.offsetHeight
|
2018-03-09 19:42:57 +08:00
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
cardStyle () {
|
|
|
|
|
return {
|
|
|
|
|
top: `${this.top}px`,
|
|
|
|
|
right: `${this.right}px`,
|
|
|
|
|
bottom: `${this.bottom}px`,
|
|
|
|
|
left: `${this.left}px`
|
|
|
|
|
}
|
2018-03-10 21:13:19 +08:00
|
|
|
},
|
|
|
|
|
bodyStyle () {
|
|
|
|
|
return {
|
|
|
|
|
top: `${this.headerHeight}px`
|
|
|
|
|
}
|
2018-03-09 19:42:57 +08:00
|
|
|
}
|
2018-03-09 19:38:33 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.dd-card-full {
|
|
|
|
|
position: absolute;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
border: 1px solid #ebeef5;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
color: #303133;
|
2018-03-09 19:42:57 +08:00
|
|
|
&:hover {
|
|
|
|
|
box-shadow: 0 0 8px 0 rgba(232,237,250,.6), 0 2px 4px 0 rgba(232,237,250,.5);
|
|
|
|
|
}
|
2018-03-09 19:38:33 +08:00
|
|
|
.dd-card-full__header {
|
2018-03-10 21:13:19 +08:00
|
|
|
position: absolute;
|
|
|
|
|
width: 100%;
|
2018-03-09 19:38:33 +08:00
|
|
|
padding: 18px 20px;
|
|
|
|
|
border-bottom: 1px solid #ebeef5;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
|
|
|
|
.dd-card-full__body {
|
2018-03-10 21:13:19 +08:00
|
|
|
position: absolute;
|
2018-03-09 19:38:33 +08:00
|
|
|
padding: 20px;
|
2018-03-10 21:13:19 +08:00
|
|
|
left: 0px;
|
|
|
|
|
right: 0px;
|
|
|
|
|
bottom: 0px;
|
|
|
|
|
overflow: auto;
|
2018-03-09 19:38:33 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|