i'm working on a vue file and have a form :
<div class="input-group">
<span class="input-group-addon">Montant</span>
<input type="number" class="form-control" v-model="amount" v-bind:value="pattern['value']"]>
</div>
my tab pattern is loaded like that :
var request = $.ajax({
url: '{{ path ('home') }}promos/pattern/'+value,
})
request.success(function(data){
if(data['pattern']==='yes'){
this.pattern=data[0];
alert(this.pattern['value']);
}
})
and my instance :
var instance = new Vue({
el: "#General",
data: {
[...]
pattern: []
}
and the request is made evertyime i do 'action a'. I have the right alert with the value i want everytime i do 'action a' but the input stays at 0 and won't dynamically change.
v-model="amount"rewrites whatever value you specify toamountvalue. Yourv-modelusage is wrong. 1) Where is youramountset? 2) Use eitherv-modelOR:value, not both.patternis an object. You should usethis.set(obj, prop, value)in order to make it reactive if properties are not defined indata: vuejs.org/v2/api/#vm-set If it doesn't help - provide a workable fiddle with dummy fetching etc.alert(this.pattern['value'])works great, so that mean pattern is correctly setting