-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
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
v-model with attribute lazy #2083
Comments
Could you provide an example please? |
when you first add the date watcher activated twice |
I don't think that I've understand yourissue very well. To be honest it seems to me that the watch callback lacks in logic. Your original pen shows that as soon as the input got focus the alert get a +1. But that's because the watch is missing some logic. Try this, a simple and ghetto solution, not the best one: <div id="demo">
<p>{{alert}}</p>
<p>Old Val: {{ old }}</p>
<p>New Val: {{ new }}</p>
<hr />
<input id="datepicker" v-model="message" lazy>
</div> var demo = new Vue({
el: '#demo',
data: {
message: null,
alert : 0,
old: 0,
new: 0,
},
watch : {
'message' : function(newVal, oldVal) {
if(oldVal !== null)
{
this.alert = this.alert + 1;
this.old = oldVal;
this.new = newVal;
}
}
}
});
$(function() {
$( "#datepicker" ).datepicker();
}); |
It does not work if the value will be written or inserted manually |
@PavelCSS It was a silly solution to point out that the problem is how you are implementing the |
v-model with attribute lazy is activated twice when blur and change. I think enough to a change event?!
The text was updated successfully, but these errors were encountered: