Add remove option for new depicts list.
This commit is contained in:
parent
9b92884523
commit
fa75292e22
|
@ -6,6 +6,9 @@ var app = new Vue({
|
|||
new_depicts: [],
|
||||
},
|
||||
methods: {
|
||||
remove(index) {
|
||||
this.$delete(this.new_depicts, index);
|
||||
},
|
||||
add_depicts(hit) {
|
||||
this.new_depicts.push(hit);
|
||||
this.hits = [];
|
||||
|
|
|
@ -62,10 +62,11 @@
|
|||
<div id="app" class="mt-2">
|
||||
<h3>what can you see in this painting?</h3>
|
||||
|
||||
<div v-for="hit in new_depicts">
|
||||
<div v-for="(hit, index) in new_depicts">
|
||||
<div>
|
||||
{{ hit.label }}
|
||||
<span v-if="hit.alt_label">({{ hit.alt_label }})</span>
|
||||
<a href="#" @click.prevent="remove(index)" >remove</a>
|
||||
— {{ hit.count }} existing paintings
|
||||
({{ hit.qid }})
|
||||
<a :href="'https://www.wikidata.org/wiki/' + hit.qid">view on Wikidata</a>
|
||||
|
@ -79,7 +80,7 @@
|
|||
<div id="item-list">
|
||||
<div v-for="hit in hits">
|
||||
<div>
|
||||
<a href="#" @click="add_depicts(hit)">{{ hit.label }}</a>
|
||||
<a href="#" @click.prevent="add_depicts(hit)">{{ hit.label }}</a>
|
||||
<span v-if="hit.alt_label">({{ hit.alt_label }})</span>
|
||||
— {{ hit.count }} existing paintings
|
||||
({{ hit.qid }})
|
||||
|
|
Loading…
Reference in a new issue