尝试解决一些ts的类型问题。

This commit is contained in:
2023-03-27 00:30:33 +08:00
parent 5325a283a5
commit 892e09de77
6 changed files with 67 additions and 7 deletions

View File

@@ -78,14 +78,25 @@
// @ts-expect-error 之后再补充类型文件
import { hasOnlyChild } from "@/router/index.js";
import { useRoute, useRouter } from "vue-router";
// import { useRoute, useRouter, type RouteRecordNormalized, type _RouteRecordBase } from "vue-router";
import { computed } from "vue";
// declare interface SideBarRouteRecordNormalized extends RouteRecordNormalized
// {
// hidden?: boolean;
// }
// declare interface SideBarRouteRecordSingleView extends _RouteRecordBase
// {
// }
export default {
name: "LayoutAside",
setup()
{
const router = useRouter();
const routes = router.getRoutes();
const routes = router.getRoutes();// as SideBarRouteRecordNormalized[];
const currentPath = computed(() =>
{

View File

@@ -0,0 +1,20 @@
/*
* @Author: Kane
* @Date: 2023-03-26 23:30:16
* @LastEditors: Kane
* @FilePath: /task_schedule/src/router/index.d.ts
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import { type RouteRecordNormalized, type RouteRecordRaw } from "vue-router";
export declare interface SideBarRouteRecordNormalized extends RouteRecordNormalized
{
hidden?: boolean;
}
export declare let route: SideBarRouteRecordNormalized;
// export declare interface SideBarRouteRecordRaw extends RouteRecordRaw
// {}

View File

@@ -38,8 +38,7 @@
"src/**/*.tsx",
"src/**/*.vue",
"*.d.ts",
"src/router/index.ts",
"src/router/index.ts",
"src/router/index.d.ts",
],
"exclude": [
"./node_modules",