kailong321200875 1 rok temu
rodzic
commit
df5b7166b4

+ 12 - 7
src/components/TagsView/src/TagsView.vue

@@ -245,6 +245,16 @@ const move = (to: number) => {
   start()
 }
 
+const canShowIcon = (item: RouteLocationNormalizedLoaded) => {
+  if (
+    (item?.matched?.[1]?.meta?.icon && unref(tagsViewIcon)) ||
+    (item?.meta?.affix && unref(tagsViewIcon) && item?.meta?.icon)
+  ) {
+    return true
+  }
+  return false
+}
+
 onMounted(() => {
   initTags()
   addTags()
@@ -357,13 +367,8 @@ watch(
                   class="h-full flex justify-center items-center whitespace-nowrap pl-15px"
                 >
                   <Icon
-                    v-if="
-                      item?.matched &&
-                      item?.matched[1] &&
-                      item?.matched[1]?.meta?.icon &&
-                      tagsViewIcon
-                    "
-                    :icon="item?.matched[1]?.meta?.icon"
+                    v-if="canShowIcon(item)"
+                    :icon="item?.matched?.[1]?.meta?.icon || item?.meta?.icon"
                     :size="12"
                     class="mr-5px"
                   />

+ 1 - 0
src/store/modules/permission.ts

@@ -46,6 +46,7 @@ export const usePermissionStore = defineStore('permission', {
         if (type === 'server') {
           // 模拟后端过滤菜单
           routerMap = generateRoutesByServer(routers as AppCustomRouteRecordRaw[])
+          console.log(routerMap)
         } else if (type === 'frontEnd') {
           // 模拟前端过滤菜单
           routerMap = generateRoutesByFrontEnd(cloneDeep(asyncRouterMap), routers as string[])