Sorry for my begginner question, but I'm stucked since yesterday on a basic problem which i cannot figure out the solution.
I want to fill my variable logs with some json object and render it in an array.
Here is my html :
<tbody>
<tr v-for="log in logs">
<td>{{log.incident}}</td>
<td>{{log.request}}</td>
<td>{{log.requested}}</td>
<td>{{log.message}}</td>
</tr>
</tbody>
and here is my JS
let vm = new Vue({
el: '#container',
components: {
'table-header': tableHeader,
},
data: {
logs: []
},
methods: {
getLogs() {
addon.port.on('log', function (data) {
console.log(data);
this.$add('logs',data)
});
}
},
ready:{
function(){this.getLogs()}
}
});
vm.getLogs();
- The ready does not seems to work. Why?
- The this.logs is undefined? Why?
- It complains that the "this.$add is not a function"
- In the html the logs are never populated in the loop. why?