From 92cd3be8a166e9d7c67f88518111670be8b9ec98 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期二, 08 四月 2025 11:01:55 +0800
Subject: [PATCH] 学生目录tag切换bug修改

---
 src/views/directory/index.vue |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/src/views/directory/index.vue b/src/views/directory/index.vue
index 3cf48be..9b3add0 100644
--- a/src/views/directory/index.vue
+++ b/src/views/directory/index.vue
@@ -22,10 +22,7 @@
     <!-- 鍒楄〃鏄剧ず -->
     <div class="page-main" v-if="activeTabs == 'list'">
       <div v-for="(item, index) in universityList" :key="index">
-        <div
-          class="table-title"
-          v-if="item.studentList && item.studentList.length > 0"
-        >
+        <div class="table-title" v-if="item.studentList && item.studentList.length > 0">
           <div class="table-title-left">
             <p class="table-title-name">{{ item.name }}</p>
             <p class="table-title-degree">{{ item.degree }}</p>
@@ -34,10 +31,7 @@
           <div class="table-title-right" @click="item.isShow = !item.isShow"><img
               :src="[item.isShow ? topIcon : bottomIcon]" alt=""></div>
         </div>
-        <table
-          cellpadding="100"
-          v-if="item.studentList && item.studentList.length > 0 && item.isShow"
-        >
+        <table cellpadding="100" v-if="item.studentList && item.studentList.length > 0 && item.isShow">
           <tr class="table-heading">
             <th>濮撳悕</th>
             <th>鎬у埆</th>
@@ -279,7 +273,6 @@
 
   mounted() {
     this.initChart();
-
     window.addEventListener("resize", this.handleResize);
   },
   beforeDestroy() {
@@ -292,10 +285,15 @@
     changeTab(key) {
       this.activeTabs = key;
       console.log(this.activeTabs, "activeTabs");
+      if (key == "chart") {
+        this.$nextTick(() => {
+          this.initChart();
+          window.addEventListener("resize", this.handleResize);
+        });
+      }
     },
     initChart() {
       this.chart = echarts.init(this.$refs.chart);
-
       const option = {
         tooltip: {
           trigger: "item",
@@ -320,22 +318,20 @@
                     color: #333;
                     font-weight: bold;
                   ">${data.name}</span>
-                  ${
-                    data.customInfo
-                      ? `<span style="
+                  ${data.customInfo
+                ? `<span style="
                     background: #ffeb3b;
                     padding: 2px 5px;
                     border-radius: 3px;
                     margin-left: 8px;
                     font-size: 12px;
                   ">${data.customInfo}</span>`
-                      : ""
-                  }
+                : ""
+              }
                 </div>
                 <div style="margin-top: 8px;">
-                  <div>鑺傜偣鍊�: <span style="color: #4f8ff7;">${
-                    data.value || 0
-                  }</span></div>
+                  <div>鑺傜偣鍊�: <span style="color: #4f8ff7;">${data.value || 0
+              }</span></div>
                   <div>鎻忚堪: ${data.description || "鏆傛棤鎻忚堪"}</div>
         
                 </div>
@@ -491,9 +487,11 @@
     /* 绉婚櫎鏈�鍚庝竴琛岀殑涓嬭竟妗� */
   }
 }
+
 .charts-main {
   // background-color: #000;
 }
+
 .table-title {
   display: flex;
   align-items: center;

--
Gitblit v1.9.1