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