Book Image

Vue.js 2 Web Development Projects

Book Image

Vue.js 2 Web Development Projects


Overview of this book

Do you want to make your web application amazingly responsive? Are you unhappy with your app's performance and looking forward to trying out ways to make your app more powerful? Then Vue.js, a framework for building user interfaces, is a great choice, and this book is the ideal way to put it through its paces. This book's project-based approach will get you to build six stunning applications from scratch and gain valuable insights in Vue.js 2.5. You'll start by learning the basics of Vue.js and create your first web app using directives along with rich and attractive user experiences. You will learn about animations and interactivity by creating a browser-based game. Using the available tools and preprocessor, you will learn how to create multi-page apps with plugins. You will create highly efficient and performant functional components for your app. Next, you will create your own online store and optimize it. Finally, you will integrate Vue.js with the real-time Meteor library and create a dashboard showing real-time data. By the end of this book you will have enough skills and will have worked through enough examples of real Vue.js projects to create interactive professional web applications with Vue.js 2.5.
Table of Contents (15 chapters)

Embedding Google Maps

In this second part, we are going to add a map to the home page and control it through the Vuex store.


To integrate Google Maps, we will need an API and a third-party package called vue-googlemaps.

Getting the API key

To use Google Maps in our app, we need to enable the corresponding API and generate an API key:

  1. In the Google Developers Console, go back to the APIs & services|Library and click on Google Maps JavaScript API under the Google Maps APIs section. On the API page, click on the Enable button.
  2. Then go to Credentials and create a new API key.

Installing the library

We will now install the vue-googlemaps library, which will help us integrate Google Maps into our app.

  1. In the app, install the vue-googlemaps package with the following command:
      npm i -S vue-googlemaps
  1. In the main main.js file, you can enable it in the app with the API key from Google:
      import VueGoogleMaps from 'vue-googlemaps'

Vue.use(VueGoogleMaps, {
load: {
          apiKey: ...