Adding routing to the Photo Manager app
Without the Vue Router plugin, we cannot display the page components inside our app. The links won't work and we cannot redirect anywhere. To add the Vue Router plugin, we need to register it and then add the routes. We add the following code to the src/main.js
file:
import { createApp } from 'vue' import App from './App.vue' import { createRouter, createWebHistory } from 'vue-router' import PhotoFormPage from './components/PhotoFormPage'; import SearchPage from './components/SearchPage'; import HomePage from './components/HomePage'; const routes = [ Â Â { path: '/add-photo-form', component: PhotoFormPage }, Â Â { path: '/edit-photo-form/:id', component: PhotoFormPage }, Â Â { path: '/search', component: SearchPage }, Â Â { path: '/', component: HomePage }, ] const router = createRouter({ Â Â history...