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

Wormhole.hasTarget() not a function with Vue3 #401

Open
cbloss opened this issue Oct 2, 2023 · 2 comments
Open

Wormhole.hasTarget() not a function with Vue3 #401

cbloss opened this issue Oct 2, 2023 · 2 comments

Comments

@cbloss
Copy link

cbloss commented Oct 2, 2023

Hey! I may be a complete blonde but I'm not seeing in the new Vue3 docs that Wormhole lost the method hasTarget. Has there been a change there? Here's what I got

 if (Wormhole.hasTarget('blockSettings')) {
    Wormhole.close({to: 'blockSettings'}, true)
  }

Ends up with:
portal_vue__WEBPACK_IMPORTED_MODULE_0__.Wormhole.hasTarget is not a function

Thanks!!

@kat3su
Copy link

kat3su commented Nov 8, 2023

@cbloss Wormhole in portal-vue 3 is no longer Singleton so you need to inject it to your component to use.

<script setup>
const wormhole = useWormhole().
if (wormhole.transports.get('blockSettings')) { } // also worm hole no longer has `hasTarget`. Use `transports` instead
</script>

@cbloss
Copy link
Author

cbloss commented Nov 22, 2023

Hey @kat3su ! Appreciate you reaching out but this still returns undefined. :(

image

When I console.log(wormhole.transports) the item is there but then when I wormhole.transports.get('blockSettings') it's undefined.

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

2 participants