vue3-router
v1.0.1
Published
Route library for vuejs 3
Downloads
227
Readme
Lib Vue3-router from Vuejs3
Install
npm install --save vue3-router
Use
In main.js
import { createApp } from 'vue'
import App from './App.vue'
import { vue3Route } from 'vue3-router'
createApp(App)
.component('vue3-router', vue3Route)
.use(vue3Route)
.mount('#app')
In App.vue, use the component:
<vue3-router />
Configure your routes:
- Create a dir
./src/router
- Create a file
./src/router/index.js
- Create your routes.
Example:
import Home from '@/components/Home'
const myFirstRoute = () => 'Hello! This is a my first route!'
const routes = [
{
path: '/',
component: Home,
auth: false
},
{
path: '/vue3-router',
component: () => 'Welcome to package vue3-router',
auth: false
},
{
path: '/my-first-route',
component: myFirstRoute,
auth: false
}
]
export {
routes
}