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...