Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
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

import { createApp } from 'vue'
import App from './App.vue'
import VueGapi from 'vue-gapi'

const app = createApp(App).mount('#app')

app.use(VueGapi, {
  apiKey: 'my_key',
  clientId: 'my_client_id',
  discoveryDocs: ['https://sheets.googleapis.com/$discovery/rest?version=v4'],
  scope: 'https://www.googleapis.com/auth/spreadsheets',
})

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!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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:

import { createApp } from 'vue'
import App from './App.vue'
import VueGapi from 'vue-gapi'

const app = createApp(App)

app.use(VueGapi, {
    apiKey: 'my_key',
    clientId: 'my_client_id',
    discoveryDocs: ['https://sheets.googleapis.com/$discovery/rest?version=v4'],
    scope: 'https://www.googleapis.com/auth/spreadsheets',
})

app.mount('#app')

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)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!