-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(router): adds global router to work with only one vue app
- Loading branch information
Augusto Ferreira | ROIT
committed
Apr 13, 2023
1 parent
46a871c
commit 4225358
Showing
9 changed files
with
37 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { createRouter, createWebHistory } from "vue-router"; | ||
|
||
export const router = createRouter({ | ||
history: createWebHistory(), | ||
linkActiveClass: "active", | ||
routes: [ | ||
{ path: '/page1', alias: '/app2', component: () => import("./views/Page1.vue") }, | ||
{ path: '/page2', component: () => import("./views/Page2.vue") }, | ||
{ path: '/page3', component: () => import("./views/Page3.vue") }, | ||
], | ||
}); | ||
export const app2Routes = [ | ||
{ | ||
path: '/app2', | ||
redirect: "/app2/page1", | ||
component: () => import("./App.vue"), | ||
children: [ | ||
{ path: 'page1', component: () => import("./views/Page1.vue") }, | ||
{ path: 'page2', component: () => import("./views/Page2.vue") }, | ||
{ path: 'page3', component: () => import("./views/Page3.vue") }, | ||
] | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
<template> | ||
Page 2 | ||
</template> | ||
<h1>Page 1</h1> App2 count: {{ store.getters.getValue }} | ||
<div class="flex gap-4"> | ||
<button @click="store.commit('decrement')"> Decrement </button> | ||
<button @click="store.commit('increment')"> Increment </button> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { store } from "../store"; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
declare module "shell/RootStore"; | ||
declare module "app2/bootloader"; | ||
declare module "app2/routes"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { createRouter, createWebHistory } from "vue-router"; | ||
import { app2Routes } from "app2/routes"; | ||
|
||
export const router = createRouter({ | ||
history: createWebHistory(), | ||
linkActiveClass: "active", | ||
routes: [ | ||
{ path: '/home', alias: '/', component: () => import("./views/Home.vue") }, | ||
{ path: '/app2', component: () => import("./views/App2.vue") }, | ||
...app2Routes, | ||
{ path: '/app3', component: () => import("./views/App3.vue") }, | ||
], | ||
}); |
This file was deleted.
Oops, something went wrong.