tawk / tawk-messenger-vue-3

Official Vue 3 plugin for Tawk messenger
https://tawk.to
Other
10 stars 5 forks source link

window.Tawk_API.visitor is not a function #5

Closed cupmm closed 1 year ago

cupmm commented 2 years ago

Uncaught TypeError: window.Tawk_API.visitor is not a function at eval (tawk-messenger-vue-3.es.js?e3d3:228:1) at eval (Twak.vue?dd48:30:1) at eval (tawk-messenger-vue-3.es.js?e3d3:127:1) at e.value (twk-chunk-common.js:2:158302) at e.value (twk-chunk-common.js:2:157948) at e.value (twk-chunk-common.js:2:81137) at twk-chunk-common.js:2:78240

jaoaustero commented 2 years ago

hi @cupmm can you share how did you use the API for visitor?

bhaviljain68 commented 2 years ago

I was having the same issue, but with the toggle() function. I basically copied what was shown in the docs here.

`// Composition API

` I removed the `toggle()` call from the script, and it worked as I’m calling the function from the template. @jaoaustero ... I would like to know how you would call a function from the script, though.
jaoaustero commented 2 years ago

Hi @bhaviljain68 in composition API, we call like this way. We wrapped it on onLoad, you might experience not a function because the widget is not yet loaded.

<script setup>
    const toggle = inject('toggle');
    const onLoad = inject('onLoad');

    onLoad(() => {
        toggle();
    });
</script>
bhaviljain68 commented 2 years ago

Hi @jaoaustero

Thanks for the quick response... :)

A suggestion that I think could help others... Please update the documentation here