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

Cannot read properties of undefined (reading 'isVisible') #4

Open
smilburn1990 opened this issue May 10, 2023 · 0 comments
Open

Cannot read properties of undefined (reading 'isVisible') #4

smilburn1990 opened this issue May 10, 2023 · 0 comments

Comments

@smilburn1990
Copy link

smilburn1990 commented May 10, 2023

Weirdly I get the error - Cannot read properties of undefined (reading 'isVisible')

when I try to use the component. my code is as follows

  <confetti-explosion
    v-if="parseFloat(totalPrice) >= 40"
    :colors="['#ff1e5f', '#6543fe']"
  />

Might also be worth mentioning that I'm using it as a Nuxt plugin like so...

import Vue from "vue"
import ConfettiExplosion from "vue-confetti-explosion"

Vue.use(ConfettiExplosion)

Any idea why? ChatGPT seems to think this...

Based on the code you provided, the isVisible variable is defined within the setup() function using the ref() function, but it's not exported as a part of the component's public API. Therefore, other parts of the component that are outside the setup() function cannot access isVisible, resulting in the error you're seeing.

To fix this, you can add isVisible to the component's return statement so that it's included in the public API:

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

No branches or pull requests

1 participant