- Lab
- Core Tech

Guided: Building a Flashcard App in Vue 3

Path Info
Table of Contents
-
Challenge
Introduction
In this lab, you will be creating a simple Flashcard studying application in Vue.js. You will be working on 5 different files, which are
Flashcard.vue
,FlashcardForm.vue
,FlashcardList.vue
,FlashcardScroller.vue
and finallyApp.vue
, which will incorporate the other components. Completing this lab will involve the usage of Vue concepts such as interactions between parent and child components, binding variables, and the use of custom and built-in directives.The app can be run by clicking the Run button at the bottom right of the terminal or by running the command
npm run dev -- --host
within the terminal. You can view the app in the Web Browser tab by refreshing the page. -
Challenge
Complete the Flashcard Component
First, you will be working in the
Flashcard
component. This component contains the term and definition of each card and displays it according to the view selected.Props are variables that can be passed into the component by a parent component, and the type, necessity, and other characteristics of these variables are defined in the
props
object. Each component tracks its own data, stored within thedata()
function. This function returns an object containing the state data. This state data will trigger an update if changed within the component. The objectmethods
defines all of the Javascript functions that can be used by the component. This component only needs theflip
function, which will be used in the scroller view to flip the card between its term and definition. To complete the component, you will need to adjust the current htmltemplate
at the top of the file to be responsive to thelist
variable. You will then need to create elements within the existing html to display the correct information. TheFlashcard
component is now complete! -
Challenge
Complete the FlashcardForm Component
Next, you will be working in the
FlashcardForm
component. This component contains the form elements that allow the user to add new Flashcards.Once again, you will be altering the
data()
function. TheFlashcardForm
component is now complete! -
Challenge
Complete the FlashcardList Component
Next, you will be completing the
FlashcardList
component. This component combines theFlashcard
andFlashcardForm
components to display them as a list and allow the user to add new flashcards. Thecomponents
object registers all of the custom components you are using in thetemplate
. Without importing and registering correctly, these components will not work. TheFlashcardList
component is now complete! -
Challenge
Complete the FlashcardScroller Component
Next, you will be completing the
FlashcardScroller
component. This component uses theFlashcard
component to display flashcards in a scroller view in a study format. TheFlashcardScroller
component is now complete! -
Challenge
Implement the App Component
To complete the application, you will implement the components you have made in the
App.vue
file. You will begin by doing many of the same steps as previous components. Congratulations! The entire application is now complete!You can see it working by clicking the Run button at the bottom right of the terminal or by running the command
npm run dev -- --host
within the terminal. You can view the app in the Web Browser tab by refreshing the page.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.