Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue 3 Support #17

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Vue 3 Support #17

wants to merge 2 commits into from

Conversation

YanDevDe
Copy link

In order to use Vue 3 Plugins, you need to import Vue3Plausible instead of VuePlausible

import { createApp, reactive } from 'vue'
import {Vue3Plausible} from "vue-plausible

const app = createApp(App)
app.use(Vue3Plausible, {
    domain: "<domain>"
    //..other configurations
});";

The typing may need some working as well. Temporarly I used //@ts-ignore here since most of the typings is still using Vue 2 instead from Vue 3. Any Pull Request at my side is welcome.

This is just a quick solution for people who need Vue 3 support right now.

@YanDevDe YanDevDe mentioned this pull request Jan 10, 2022
@YanDevDe
Copy link
Author

Also I removed lib in .gitignore - so then it can be directly used per npm i https://github.com/YanDevDe/vue-plausible for temporary solution.

@@ -13,6 +13,8 @@ const defaultOptions: PlausibleModuleOptions = {
}

const PlausibleModule: Module<PlausibleModuleOptions> = function (moduleOptions) {
if (!this) return;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was receiving error by using Vue 3 because "this" didn't existed here. I didn't even used Nuxt here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant