vue3-router-exercise
Exercise N°8
-
install
vue-router
dependency. -
Fill the
router.js
file. Use thecreateRouter
function to build app routes. Create a path for/todos
url, it will display thepages/TodoList.vue
component. Create a path for/add-todo
url, it will display thepages/AddTodo.vue
component. make url/todos
as welcome default url. Export arouter
variable which contains your routes.
-
Fill
main.js
and register your routes with router plugin. -
Fill
App.vue
, and add 2router-view
. Check the comments inside the file. -
Fill
TheNavigation.vue
and add 2router-link
. Check the comments inside the file. -
In
AddTodo.vue
file, navigate to/todos
url when the user add a todo. Check the comment inside the file. -
Finally add a component
TheFooter.vue
insrc/components/UI
. Display any text. Use this component in the footer named router-view (App.vue
) for/todos
and/add-todo
urls.
Project setup
npm install
Compiles and hot-reloads for development
npm run serve
Compiles and minifies for production
npm run build
Lints and fixes files
npm run lint