Skip to content

Commit

Permalink
✨ 路由功能
Browse files Browse the repository at this point in the history
  • Loading branch information
xkrfer committed Apr 1, 2022
1 parent 8fb452d commit 748a878
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
7 changes: 2 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/popup.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="root">
<init-server/>
<router-view/>
</div>
</template>

Expand Down
7 changes: 4 additions & 3 deletions src/edge/popup/popup.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { createApp } from 'vue'
import {createApp} from 'vue'
import Popup from '@/components/popup.vue'
import "@/styles/popup.less"
import { createPinia } from 'pinia'
import {createPinia} from 'pinia'
import {router} from "./router"
const app = createApp(Popup)

app.use(router)
app.use(createPinia())
app.mount('#app')
13 changes: 13 additions & 0 deletions src/edge/popup/router.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {createWebHashHistory, createRouter} from "vue-router"
import InitServer from "@/components/popup/init-server.vue"

export const router = createRouter({
// 4. 内部提供了 history 模式的实现。为了简单起见,我们在这里使用 hash 模式。
history: createWebHashHistory(),
routes: [
{
path: "/init-server",
component: InitServer
}
]
});
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@

"vue-router@^4.0.14":
"integrity" "sha512-wAO6zF9zxA3u+7AkMPqw9LjoUCjSxfFvINQj3E/DceTt6uEz1XZLraDhdg2EYmvVwTBSGlLYsUw8bDmx0754Mw=="
"resolved" "https://registry.npmjs.org/vue-router/-/vue-router-4.0.14.tgz"
"resolved" "https://registry.npmmirror.com/vue-router/-/vue-router-4.0.14.tgz"
"version" "4.0.14"
dependencies:
"@vue/devtools-api" "^6.0.0"
Expand Down

0 comments on commit 748a878

Please sign in to comment.