// Import Vue and Vue Router
import Vue from 'vue'
import VueRouter from 'vue-router'
// Use Vue Router
Vue.use(VueRouter)
// Define your routes
const routes = [
{ path: '/', component: Home },
{ path: '/about', component: About },
{ path: '/contact', component: Contact }
]
// Create a router instance with your routes
const router = new VueRouter({
routes
})
// Create a Vue instance with the router
const app = new Vue({
router
}).$mount('#app')
// Programatically navigate to a route
// Option 1: Using router.push method
router.push('/about')
// Option 2: Using router.replace method
router.replace('/contact')
// Option 3: Using router.go method to navigate back or forward
router.go(-1) // Navigates back one step
router.go(1) // Navigates forward one step