Explorar o código

router with type

Benjamin Kornblum hai 5 meses
pai
achega
efeb0c2afa
Modificáronse 2 ficheiros con 4 adicións e 2 borrados
  1. 3 2
      src/router/index.ts
  2. 1 0
      src/types/page.ts

+ 3 - 2
src/router/index.ts

@@ -1,11 +1,12 @@
 import { createRouter, createWebHistory } from 'vue-router'
 import HomeView from '@/views/HomeView.vue'
 import PageView from '@/views/PageView.vue'
+import type { Page } from '@/types/page'
 
-const addPages = [] as Array<any>
+const addPages = [] as Array<Page>
 
 
-export function loadDynamicPages(pages:Array<any>){
+export function loadDynamicPages(pages:Array<Page>){
 
   for (const page of addPages){
     router.removeRoute(page.Title!)

+ 1 - 0
src/types/page.ts

@@ -3,4 +3,5 @@ import type { Content } from './content'
 export interface Page {
   Title: string;
   Content: Array<Content>;
+  path: string;
 }