ktquez / vue-disqus

Integrate Disqus count and comments in your application Vue 3, with support for SPA
https://ktquez.github.io/vue-disqus/
MIT License
253 stars 26 forks source link

How to use `reset` in Vue 3 script setup #101

Open mrleblanc101 opened 1 year ago

mrleblanc101 commented 1 year ago

I see you provide app.provide(Symbol('disqus'), disqusConfig), but since you don't export the symbol, we cannot import it to use for the inject. See the documentation here: https://vuejs.org/guide/components/provide-inject.html#working-with-symbol-keys

mrleblanc101 commented 1 year ago

@ktquez Had any chance to look into this ?

mrleblanc101 commented 1 year ago

I think you need to change Vue.prototype to app.config.globalPropriety in Vue 3: https://v3-migration.vuejs.org/breaking-changes/global-api.html#vue-prototype-replaced-by-config-globalproperties

mrleblanc101 commented 1 year ago

Found an alternative, just use a dynamic key with the colorMode as the value which reload the component completely on change forcing the init function to rerun.

<ClientOnly>
    <Disqus class="mt-8" :key="colorMode.value" />
</ClientOnly>
ktquez commented 1 year ago

Hello @mrleblanc101, how are you?

I'll take a look and as soon as I publish a new version, I'll let you know here.

mrleblanc101 commented 1 year ago

@ktquez It's all good, I think we could simply document my solution in the README for Vue 3, don't need to change anything

jshelver commented 1 year ago

@mrleblanc101 you are a godsend my man. :key still fixes reload issue.