I am working with Vue.js and Django. My goal is to display a list of bins, which I get over a REST API.
Here's my JavaScript-Code:
Vue.component('bin-detail', {
template: '#bin-detail',
props: ['bin']
});
var app = new Vue({
el: '#table',
data: {
message: "Hallo",
bins: []
},
mounted: function() {
$.get('/api/bins/', function (data) {
app.bins = data.results;
})
},
delimiters: ['<%', '%>']
});
And my HTML:
<div id="table">
<h1><% message %></h1>
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr v-for="bin in bins" is="bin-detail" :bin="bin"></tr>
</tbody>
</table>
</div>
<template id="bin-detail">
<tr>
<td>
<% bin.name %>
</td>
</tr>
</template>
The message data is displayed correctly, but the name stays "<% bin.name %> on the rendered page after the GET request has been received. Using the Vue-Inspector I can see, that the component has been generated correctly But the template does not get updated: Anyone an idea, what I'm doing wrogn?