Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (42 sloc) 1.12 KB
<div id="app">
<h1>Tasks - index</h1>
<hr />
<a class="btn btn-primary" href="/tasks/new"> add</a>
<hr />
<ul v-for="task in tasks" v-bind:key="task._id">
<li>{{ task.title }} / id: {{ task._id }}
<p>{{ task.content }}</p>
<a v-bind:href="'/tasks/show/' + task._id">[show]</a><br />
<a v-bind:href="'/tasks/edit/' + task._id">[edit]</a><br />
</li>
</ul>
</div>
<!-- -->
<script>
new Vue({
el: '#app',
created () {
this.getTasks();
console.log("#tasks.index");
},
data: {
msg : "aa-1234",
tasks: [],
},
methods: {
getTasks () {
axios.get("/api/tasks_index").then(res => {
// console.log(res.data.docs);
var items = res.data.docs
var arr =[];
items.forEach( function (item) {
item.url ="/tasks/show/" + item._id,
arr.push(item)
});
this.tasks = arr;
console.log( this.tasks );
})
}
}
});
</script>
You can’t perform that action at this time.