|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="elem-explain-children">
|
|
|
- <div class="elem-title" v-if="data.showTitle">
|
|
|
+ <div class="elem-title" v-if="data.showTitle" ref="ElemTitle">
|
|
|
{{ data.parent.topicName }}
|
|
|
</div>
|
|
|
<div class="elem-body" :style="explainBodyStyle">
|
|
@@ -36,19 +36,34 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ explainBodyStyle: {}
|
|
|
+ };
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState("card", ["curDragElement"]),
|
|
|
- explainBodyStyle() {
|
|
|
- const height = this.data.showTitle ? this.data.h - 24 : this.data.h;
|
|
|
- return {
|
|
|
- height: height + "px"
|
|
|
- };
|
|
|
+ ...mapState("card", ["curDragElement"])
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ "data.parent": {
|
|
|
+ handler() {
|
|
|
+ this.modifyBodyStyle();
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ this.modifyBodyStyle();
|
|
|
+ },
|
|
|
methods: {
|
|
|
...mapMutations("card", ["setCurDragElement", "setCurElement"]),
|
|
|
+ modifyBodyStyle() {
|
|
|
+ let height = this.data.h;
|
|
|
+ if (this.data.showTitle) {
|
|
|
+ height = this.data.h - this.$refs.ElemTitle.clientHeight;
|
|
|
+ }
|
|
|
+ this.explainBodyStyle = {
|
|
|
+ height: height + "px"
|
|
|
+ };
|
|
|
+ },
|
|
|
dropInnerElement(e) {
|
|
|
let { layerX: x, layerY: y } = e;
|
|
|
const { offsetLeft, offsetTop } = this.getOffsetInfo(e.target);
|