I am trying to define dynamic variables for VUE
, to then use them in v-for
. when loading the page they work, but if later they change their values, they do not change the values in the view.
VUE
const app = new Vue({
el: '#mainCreate',
data: {
modules : [],
feature: []
},
});
This function I am using to generate the variables within feature
:
/*crea dinamicamente los feautres en module*/
function creatDataFeatures (){
$.each(app.modules, function(index,module){
app.feature[index] = module.features;
});
}
This is how I am carrying it in view:
<!-- caracteristicas-->
<table class="table table-striped mt-3">
<tbody>
<tr v-for="feat in feature[index]">
<td>
<input type="checkbox" checked>
</td>
<td>
@{{feat.title}}
</td>
<td class="text-info">
@{{feat.price ? '$ '+feat.price : '$ 0'}}
</td>
</tr>
</tbody>
</table>
When loading the page, I load the data correctly, but if I then change the values ejm: feature[index] = [other array]
(I change it for the same data format as the start ones) in the view, nothing changes. a solution or an alternative would be great.