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

Use the plugin without node imports #38

Open
phiter opened this issue Nov 10, 2017 · 1 comment
Open

Use the plugin without node imports #38

phiter opened this issue Nov 10, 2017 · 1 comment

Comments

@phiter
Copy link

phiter commented Nov 10, 2017

Hi, I'm using vue for a single page to resolve one simple problem.

The problem is that all the examples are using imports, and I cannot use that.

I need to use the plugin without using the imports, like this plugin allows you to.

<script src="vue.min.js"></script>
<script src="v-mask.min.js"></script>
<script>
// As a plugin
Vue.use(VueMask.VueMaskPlugin);

// As a directive
Vue.directive('mask', VueMask.VueMaskDirective);
</script>

I believe it's called UMD, so is it possible to do this?

@Djangoum
Copy link

Djangoum commented Nov 14, 2017

Hi @phiterf ,

I've found a roundtrip to achieve this. Looking inside the code you can see the name "VMoney". In my browser console i've inspected this and looking inside there's an object called directives. You can insert te directive to Vuejs the following way:

Vue.directive('money', VMoney.Money.directives.money);

I hope this helps you !

EDIT:

If you want to use it as a component you can just add to your component or vue instance the component the following way:

[...] , components: { 'money' : VMoney.Money } [...]

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