Closed EgorKorol closed 6 years ago
Hey. I apologize for such a late reply :( If this is still relevant: checked with the new version, everything works fine.
My code:
mounted() {
this.$metrika.reachGoal('test-goal')
}
If you still have an error (with a new version) and want to fix it, please provide sample repo\fiddle.
My main.js:
`import router from './router' import VueYandexMetrika from 'vue-yandex-metrika'
Vue.use(VueYandexMetrika, { id: 46481307, env: process.env.NODE_ENV, router: router, clickmap: true, trackLinks: true, accurateTrackBounce: true, webvisor: true, trackHash: true })`
My components:
mounted () { if (this.isNewUser()) { this.$metrika.reachGoal('registration') } }
Result:
Error in mounted hook: "TypeError: Cannot read property 'reachGoal' of undefined"
If you set the timeout, then everything works. How can I fix this?