feat: ts命名空间
This commit is contained in:
parent
300a73fe63
commit
7ff3b00d0e
@ -18,13 +18,12 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import IconCommon from "@/layout/components/Menu/icon-common.vue";
|
import IconCommon from "@/layout/components/Menu/icon-common.vue";
|
||||||
import { RouteRecordRaw } from "vue-router";
|
|
||||||
defineOptions({ name: "MenuItem" });
|
defineOptions({ name: "MenuItem" });
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
routeTree: RouteRecordRaw[];
|
routeTree: Menu.MenuOptions[];
|
||||||
}
|
}
|
||||||
|
// type类型参考:https://cn.vuejs.org/guide/typescript/composition-api.html#typing-component-props
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
routeTree: () => []
|
routeTree: () => []
|
||||||
});
|
});
|
||||||
|
|||||||
23
src/typings/global.d.ts
vendored
23
src/typings/global.d.ts
vendored
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user