-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathmain.js
44 lines (39 loc) · 877 Bytes
/
main.js
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
const { createApp, ref } = Vue
const { createRouter, createMemoryHistory, RouterLink, RouterView } = VueRouter
import Home from './components/home.js'
import About from './components/about.js'
const routes = [
{ path: '/', component: Home },
{ path: '/about', component: About },
]
const router = createRouter({
history: createMemoryHistory(),
routes,
})
createApp({
setup() {
return {
count: ref(0)
}
},
components: {
Home,
RouterLink,
RouterView
},
template: `
<h1>Hello Vue No Node!</h1>
<p>
<strong>Current route path:</strong> {{ $route.fullPath }}
</p>
<nav>
<RouterLink to="/">Go to Home</RouterLink>
<RouterLink to="/about">Go to About</RouterLink>
</nav>
<main>
<RouterView />
</main>
`
})
.use(router)
.mount('#app')