瀏覽代碼

个人中心添加标签

liuQiang 1 年之前
父節點
當前提交
d67806ae34
共有 1 個文件被更改,包括 23 次插入5 次删除
  1. 23 5
      src/layout/indexCommon.vue

+ 23 - 5
src/layout/indexCommon.vue

@@ -27,9 +27,9 @@
               </div>
               <template #dropdown>
                 <el-dropdown-menu>
-                  <router-link to="/user/profile">
-                    <el-dropdown-item>个人中心</el-dropdown-item>
-                  </router-link>
+                  <!-- <router-link to="/user/profile"> -->
+                    <el-dropdown-item @click="toUserInfo">个人中心</el-dropdown-item>
+                  <!-- </router-link> -->
                   <el-dropdown-item divided command="logout">
                     <span>退出登录</span>
                   </el-dropdown-item>
@@ -490,7 +490,15 @@ if (hasRole) {
     }
   );
 }
-
+// 去个人中心
+const toUserInfo = ()=>{
+  const itemData = {
+      name: '个人中心',
+      path: '/user/profile',
+      clickRowId:null
+    }
+    addFolderAdd(itemData)
+}
 const clickPath = (index, items) => {
   items = toRaw(items);
   localStorage.setItem("inChat", items.path == "/index" ? 1 : 0)
@@ -557,6 +565,16 @@ const clickTab = (item) => {
           });
         return
       }
+      // 去个人中心识别单独判断
+      if (toFileData.value.name == "个人中心" || toFileData.value.label == "个人中心") {
+        // console.log("clickRowId.value", JSON.stringify(toRaw(toFileData.value).clickRowId));
+        editableTabsValue.value = toFileData.value.path
+        isAlive.value = true
+          router.push({
+            path: toFileData.value.path,
+          });
+        return
+      }
       editableTabsValue.value = toFileData.value.path
       router.push({
         path: toFileData.value.path,
@@ -747,7 +765,7 @@ const addTab = (data) => {
 };
 const addFolderAdd = (data) => {
   const arr = toRaw(editableTabs.value);
-  if (!arr.some((item) => item.label == data.clickRowId.dirName || item.label == data.name)) {
+  if (!arr.some((item) => item.label == (data.clickRowId?data.clickRowId.dirName:null) || item.label == data.name)) {
     editableTabs.value.push({
       label: data.name,
       path: data.path,