zhangjie 1 rok temu
rodzic
commit
d78d12fd37
1 zmienionych plików z 19 dodań i 19 usunięć
  1. 19 19
      card/elements/card-head/CardHeadBodyAutoResize.vue

+ 19 - 19
card/elements/card-head/CardHeadBodyAutoResize.vue

@@ -1,6 +1,6 @@
 <template>
   <div :class="classes">
-    <div class="rect-col" :style="{ width: rightColWidth + '%' }">
+    <div ref="rectColRef1" class="rect-col" style="width: 50%">
       <div
         class="rect-col-item"
         ref="stdnoContainer"
@@ -16,7 +16,7 @@
         <slot name="dynamic"></slot>
       </div>
     </div>
-    <div class="rect-col" :style="{ width: leftColWidth + '%' }">
+    <div ref="rectColRef2" class="rect-col" style="width: 50%">
       <div
         class="rect-col-item"
         ref="stdinfoContainer"
@@ -75,27 +75,27 @@ export default {
       // width size
       const fillNumber = this.data.fillNumber || 13;
       if (fillNumber <= 10) {
-        this.rightColWidth = 50;
+        this.leftColWidth = 50;
       } else {
-        let rightColWidth = 50 + 4 * (fillNumber - 10);
-        this.rightColWidth = Math.min(this.maxRigthColWidth, rightColWidth);
+        let leftColWidth = 50 + 4 * (fillNumber - 10);
+        this.leftColWidth = Math.min(this.maxRigthColWidth, leftColWidth);
       }
-      this.leftColWidth = 100 - this.rightColWidth;
+      this.rightColWidth = 100 - this.leftColWidth;
+      this.$refs.rectColRef1.style.width = `${this.leftColWidth}%`;
+      this.$refs.rectColRef2.style.width = `${this.rightColWidth}%`;
 
-      this.$nextTick(() => {
-        const containers = ["stdinfo", "notice", "stdno", "dynamic"];
-        containers.forEach((container) => {
-          const dom =
-            this.$refs[`${container}Container`] &&
-            this.$refs[`${container}Container`].firstChild;
-          this.orgHeights[container] = dom ? dom.offsetHeight : 0;
-        });
-        Object.keys(this.orgHeights).map((key) => {
-          this.heights[key] = this.orgHeights[key] + 2;
-        });
-
-        this.resizeRect();
+      const containers = ["stdinfo", "notice", "stdno", "dynamic"];
+      containers.forEach((container) => {
+        const dom =
+          this.$refs[`${container}Container`] &&
+          this.$refs[`${container}Container`].firstChild;
+        this.orgHeights[container] = dom ? dom.offsetHeight : 0;
+      });
+      Object.keys(this.orgHeights).map((key) => {
+        this.heights[key] = this.orgHeights[key] + 2;
       });
+
+      this.resizeRect();
     },
     resizeRect() {
       // height size