Chapter 2: Building a Vue 3 Progressive Web App
In this chapter, we will look at how to create a GitHub progressive web app (PWA) with Vue 3. As we build the project, we will examine the inner workings of a Vue app by looking at the basic building blocks in depth. We will create Vue apps with components and, as we create them, we will look at the parts that make up a component and how they work.
We will also use more advanced features such as directives, when we need to do so. Directives let us manipulate the Document Object Model (DOM) without cluttering up a component's code. They provide us with a clean way to access DOM elements and work with them in a reusable way. This helps make testing easier and helps us to modularize our code.
Vue 3 comes with many built-in directives that we will use. In the previous chapter, we saw a brief overview of these. In this chapter, we will go into more detail to see how they work. These directives provide easy-to-use abstractions to make many things easier for us and are a basic feature of Vue 3 that we can't live without.
We will use components to display the data we want, which will take in inputs via props so that we can get the proper data and display it. In each component, we will add our own methods and make use of some component lifecycle methods. To reduce repetition of code, we use mixins to abstract out commonly used features in components and incorporate them into our components.
In this chapter, we will look at the following topics:
- Basic theory on components and PWAs
- Introducing the GitHub portfolio app
- Creating the PWA
- Serving the PWA