Hello everyone I'm getting a handle on Vue.js and I've created a component for a table (called setupTable). I want to be able to dynamically add data to this. I know that Vue.js listens to push on data elements but I can't seem to access the data element of my component through setupTableComponent.data
. How would I access and append data to this component?
var setupTableComponent = Vue.extend({
template: '<table id="data-table">'+
'<tr v-for="item in items">'+
'<td>{{item.b}}</td>' +
'<td>{{item.d}}</td>' +
'<td>{{item.t}}</td>' +
'</tr>' +
'</table>',
data: function(){
return { items: [
{ t: "Tester", b: "Buster", d: "Duster"},
{ t: "Not a Tester", b: "Not a Buster", d: "Not a Duster"}
]};
}
});
Vue.component('setup-table-component', setupTableComponent);
var setUpDataTableV = new Vue({
el: '#sidebar',
ready: function() {
}
});