env.d.ts
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// / <reference types="vite/client" />
declare module '*.vue' {
import type { DefineComponent } from 'vue';
const component: DefineComponent<{}, {}, any>;
export default component;
}
// vue-router 类型声明(模板开发时使用,避免类型错误)
declare module 'vue-router' {
export interface RouteMeta {
[key: string]: unknown;
title?: string;
}
export interface RouteLocationNormalized {
[key: string]: unknown;
meta: RouteMeta;
name?: null | string | symbol;
path: string;
}
export type NavigationGuardNext = (to?: false | string | void) => void;
export interface RouteRecordRaw {
[key: string]: unknown;
component?: unknown;
meta?: RouteMeta;
name?: string | symbol;
path: string;
}
export interface Router {
[key: string]: unknown;
afterEach(
guard: (
to: RouteLocationNormalized,
from: RouteLocationNormalized,
) => void,
): () => void;
beforeEach(
guard: (
to: RouteLocationNormalized,
from: RouteLocationNormalized,
next: NavigationGuardNext,
) => void,
): () => void;
}
export function createRouter(options: {
history: unknown;
routes: RouteRecordRaw[];
}): Router;
export function createWebHistory(base?: string): unknown;
// 导出所有需要的类型
export type {
NavigationGuardNext,
RouteLocationNormalized,
Router,
RouteRecordRaw,
};
}
// qiankun 相关类型
declare global {
interface Window {
__INJECTED_PUBLIC_PATH_BY_QIANKUN__?: string;
__POWERED_BY_QIANKUN__?: boolean;
}
}
export {};