autoNumeric / vue-autoNumeric

A Vue.js component that wraps the awesome autoNumeric input formatter library
http://autonumeric.org
MIT License
91 stars 25 forks source link

Directive usage #23

Open shrpne opened 6 years ago

shrpne commented 6 years ago

Thanks for this great project! I want to suggest a feature. Would be great if Autonumeric could be used as a directive. As I can see this Vue integration is pretty simple and component wrapper looks like an overhead to me.

AlexandreBonneau commented 6 years ago

Hey @shrpne, my very first implementation of AutoNumeric within Vue was to use a directive, but somehow what I ended up with, although it worked great, was far too complex to my taste. You had to access the vnode info to retrieve the attached v-model name in order to prevent update loops, and so on...

That said, this is something we are open to, and If you have something in mind, please provide a PR so we can discuss how to integrate that !

shrpne commented 6 years ago

How about usage without v-model? Here is usage example of another mask Vue directive. I think it's okay to use the mask without v-model and it can be useful for someone.

AlexandreBonneau commented 6 years ago

Well if you want to 'translate' the component to a directive, you are welcome to do so. Perhaps this could live in another project like vue-autoNumeric-directive?