[Vuejs]-How to access vue JS global property in setup method

0👍

Docs says :

Since in Vue 3, the setup method doesn’t have access to this.$gtag but you can import the method you need like this

import { event } from 'vue-gtag'

export default {
  name: 'MyComponent',

  setup() {
    const login = () => {
      event('login', { method: 'Google' })
    }
    
    return {
      login
    }
  }
}

source

Leave a comment