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 cannot find toggle-button #65

Closed
burlesona opened this issue May 8, 2018 · 5 comments
Closed

Vue cannot find toggle-button #65

burlesona opened this issue May 8, 2018 · 5 comments
Labels

Comments

@burlesona
Copy link

No matter what I try, Vue doesn't seem to be able to find the component . I'm wondering if the issue is using the name when the plugin calls it ToggleButton. Trying didn't work either, for whatever reason my build just won't pick it up.

Is there a reason to favor distributing this as a vue plugin rather than just a component? Since the plugin literally just declares the component, why not instead let the user import the Button component and then use it how they see fit? That way the end user doesn't have to have this component globally if they're not using it everywhere.

@euvl euvl added the question label May 8, 2018
@euvl
Copy link
Owner

euvl commented May 8, 2018

Sooo what stops you from including just a component again? Seems to pretty much work for everyone else 🤔

Try vue-js-toggle-button/src/Button

@burlesona
Copy link
Author

burlesona commented May 8, 2018

If I ref the raw component from src it fails to build with cannot parse <template>. I'm not sure exactly what's different about my build setup as I use .vue files for SFC like anyone else, but I'm working on an older app that uses gulp + browserify rather than web pack, and I assume there's some config difference that causes the problem.

In any case I've had no trouble importing various vue components (like vuedraggable) etc. when they export a component and I can just import that, but the plugin thing just doesn't take.

I worked around it by just copying the source into my local assets and importing the component from there, but that's not as nice as being able to use the NPM package.

But, my build issues aside, I would guess that many people would rather import the component and declare it in their own components rather than have a global component declared via plugin install. /shrug Maybe just me though.

@aldencolerain
Copy link
Contributor

@euvl Thanks for the great component. Probably this is more just a documentation issue. Most Vue component packages export a component by default not a plugin although the plugin is very nice. I think this could be solved by just adding a second short paragraph or sentence showing how to import it as a component since that is what many are used to. It wasn't hard but I did need to look in the source to find the path because it wasn't documented.

@aldencolerain
Copy link
Contributor

Made a pull request #66 to document importing component directly.

@euvl
Copy link
Owner

euvl commented May 12, 2018

Hey @aldencolerain , thanks a lot for your PR. Merged 👍

@euvl euvl closed this as completed May 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants