1import { createApp } from 'vue'
2import { Router, createRouter } from 'vue-router'
3
4declare module '@vue/runtime-core' {
5 interface ComponentCustomProperties {
6 $router: Router
7 }
8}
9
10// effectively adding the router to every component instance
11const app = createApp({})
12const router = createRouter()
13app.config.globalProperties.$router = router
14
15const vm = app.mount('#app')
16// we can access the router from the instance
17vm.$router.push('/')