Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Issue with v-model #22

Closed
IvanBernatovic opened this issue May 17, 2017 · 3 comments
Closed

Issue with v-model #22

IvanBernatovic opened this issue May 17, 2017 · 3 comments

Comments

@IvanBernatovic
Copy link

Hello,

we found a bug within a very reasonable and common use case. So, we are using same form for adding and editing our data. It works perfectly in "Add" form when all fields are empty. Issue occurs when you edit data (so you already have filled form with existing data).

Our instance has a lot of fields in data, and one of them is using your plugin. On input of that field we are using v-model="'money'" directive. So, when you first initialize "Edit" form everything is displayed correctly, including the field with v-mask. But when you change and of the form data field loses mask. I think the problem is when you initialize the plugin. So, if we provide input with v-mask with value 1500 we are expecting "15,00" value in our component data field and that seems to work at first. When some other data is changed that input changes to 1500 effectively losing the mask. This is not desired. I forked your examples repo and added name property to data with value "Ivan". I also created additional input after your price input with mask. You can clone the repo here.

I also recorded a video showing a bug. I think that issue is that component data is not properly changed upon plugin initialization. So in videos example you have a price data field with a value 20. I think that it should be converted to "0,20" immediately after the initialization but that doesn't happen. Our "fix" is to programmatically trigger a change event for our input which would force plugin to convert 20 to "0,20" and from that point it works fine.

@caioincau
Copy link
Contributor

Thanks @IvanBernatovic , cloned your repo and I am working on a fix.

@caioincau
Copy link
Contributor

Can you please try version 0.5.3? @IvanBernatovic

@IvanBernatovic
Copy link
Author

@icaioincau I'm so sorry, I thought I left a comment. I checked it that same day when you commented and it seems that everything works as expected now. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants