Skip to content
Advertisement

How to configure VueGapi as global in Vue 3 App

I’m trying to use the VueGapi plugin for a gmail app in Vue. Here is my main.js

JavaScript

When I try and reference it with this.$gapi I get the Uncaught TypeError: this.$gapi is undefined

A little new to Vue so any help would be appreciated!

Advertisement

Answer

The .mount function does not return a vue app, that’s why you can”t make a use after.

You have to first create, after use and to finish mount:

JavaScript

Also you have to be sure to use Vue 3 (check vue version in your package.json) and to use the corresponding vue-gapi package (https://www.npmjs.com/package/vue-gapi)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement