feat: ts命名空间

This commit is contained in:
wang_fan_w 2024-04-17 00:20:59 +08:00
parent 300a73fe63
commit 7ff3b00d0e
2 changed files with 25 additions and 3 deletions

View File

@ -18,13 +18,12 @@
<script setup lang="ts">
import IconCommon from "@/layout/components/Menu/icon-common.vue";
import { RouteRecordRaw } from "vue-router";
defineOptions({ name: "MenuItem" });
interface Props {
routeTree: RouteRecordRaw[];
routeTree: Menu.MenuOptions[];
}
// typehttps://cn.vuejs.org/guide/typescript/composition-api.html#typing-component-props
const props = withDefaults(defineProps<Props>(), {
routeTree: () => []
});

View File

@ -0,0 +1,23 @@
/* ts命名空间 */
/* 路由-Menu */
declare namespace Menu {
interface MenuOptions {
path: string;
name: string;
redirect?: string;
component?: string | (() => Promise<unknown>);
meta: MetaType;
children?: MenuOptions[];
}
interface MetaType {
title: string;
isHide: boolean;
isKeepAlive: boolean;
isAffix: boolean;
isLink?: string;
isIframe?: boolean;
roles: Array<string>;
icon?: string;
svgIcon?: string;
}
}