vue-autoNumeric icon indicating copy to clipboard operation
vue-autoNumeric copied to clipboard

Ignoring the .lazy modifier

Open cristian-frumusanu opened this issue 6 years ago • 9 comments

Hello. Thanks for the great component!

I have identified one issue, though.

When using the .lazy modifier on v-model, the AutoNumeric component updates the model on the input event, rather than on the change event.

I have created a fiddle to illustrate the issue in which there is a standard input next to a Vue AutoNumeric component: https://jsfiddle.net/p462eLa9/1/

Please let me know your thoughts on this.

cristian-frumusanu avatar Feb 11 '19 08:02 cristian-frumusanu

You are correct, I totally overlooked that modifier!

AlexandreBonneau avatar Feb 11 '19 09:02 AlexandreBonneau

@AlexandreBonneau I'm glad I could help. Are you planning to release an update in the near future that would include the fix to this issue? Thanks.

cristian-frumusanu avatar Feb 11 '19 11:02 cristian-frumusanu

Yes, but it depends on your definition of 'near future' really :) I'm pretty swamped for a few months now, so I'll see when I can get a closer look into that issue.

If you find the solution on your end, please feel free to create a PR!

AlexandreBonneau avatar Feb 12 '19 05:02 AlexandreBonneau

@AlexandreBonneau

I've done some digging around and I don't think it's possible without this: https://github.com/vuejs/vue/issues/6914

cristian-frumusanu avatar Feb 12 '19 11:02 cristian-frumusanu

Same issue. @AlexandreBonneau, have you planned to fix the issue? @cristian-frumusanu , have you get a workaround?

doucouredave avatar Mar 19 '20 17:03 doucouredave

Same issue. @AlexandreBonneau, have you planned to fix the issue? @cristian-frumusanu , have you get a workaround?

@doucouredave

I think this works:

<VueAutonumeric @change.native="(event) => { yourVariable = event.target.value }" />

cristian-frumusanu avatar Mar 19 '20 18:03 cristian-frumusanu

Thanks for you reply @cristian-frumusanu, what does mean yourVariable? is it v-model?

doucouredave avatar Mar 20 '20 09:03 doucouredave

@doucouredave yourVariable is just the variable name. It could be foo, bar, whatever.

So, if you would normally have

<VueAutonumeric v-model="yourVariable" />

to make this work you have to write:

<VueAutonumeric @change.native="(event) => { yourVariable = event.target.value }" />

cristian-frumusanu avatar Mar 21 '20 06:03 cristian-frumusanu

I was seeing a warning from AutoNumeric about the model being undefined. So I added :value="model" to ^^

rylanb avatar Aug 07 '22 03:08 rylanb