Merge pull request #2603 from pikasTech/fix/2380-tasktree-refresh-icon
Pipelines as Code CI / hwlab-nc01-v03-ci-poll- Success

fix: 通过 Vue 组件适配导航图标
This commit is contained in:
Lyon
2026-07-17 04:19:37 +08:00
committed by GitHub
@@ -24,7 +24,7 @@ import {
ShieldCheck,
Users
} from "lucide-vue-next";
import { computed, type Component } from "vue";
import { computed, defineComponent, h, type Component, type PropType } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useAppStore } from "@/stores/app";
import { useAuthStore } from "@/stores/auth";
@@ -38,6 +38,19 @@ const router = useRouter();
const app = useAppStore();
const auth = useAuthStore();
const NavIcon = defineComponent({
name: "NavIcon",
props: {
icon: {
type: [Object, Function] as PropType<Component>,
required: true,
},
},
setup(props) {
return () => h(props.icon, { size: 18 });
},
});
interface NavItem {
name: string;
label: string;
@@ -292,7 +305,7 @@ function isActive(item: NavItem): boolean {
@click="go(item)"
>
<span class="nav-icon" aria-hidden="true">
<component :is="item.icon" :size="18" />
<NavIcon :icon="item.icon" />
</span>
<span class="nav-label">{{ item.label }}</span>
</button>