list attachments of item, see #11

This commit is contained in:
eduardohumberto 2018-05-03 21:37:26 -03:00
parent d4e550aadc
commit eb25f187cd
1 changed files with 28 additions and 5 deletions

View File

@ -56,7 +56,20 @@
<div <div
class="box"> class="box">
<p>--</p>
<div
v-if="attachments && attachments.length > 0">
<span
v-for="(attachment, index) in attachments"
:key="index"
>
<a
target="blank"
:href="attachment.guid.rendered">{{ attachment.guid.rendered }}</a>
</span>
</div>
<p v-else>--</p>
<p> <p>
<i> <i>
{{ $i18n.get('label_attachments') }} {{ $i18n.get('label_attachments') }}
@ -83,15 +96,20 @@ export default {
}, },
methods: { methods: {
...mapActions('item', [ ...mapActions('item', [
'fetchItem' 'fetchItem',
'fetchAttachments'
]), ]),
...mapGetters('item', [ ...mapGetters('item', [
'getItem' 'getItem',
'getAttachments'
]), ]),
}, },
computed: { computed: {
item(){ item(){
return this.getItem(); return this.getItem();
},
attachments(){
return this.getAttachments();
} }
}, },
created(){ created(){
@ -107,6 +125,11 @@ export default {
this.fetchItem(this.itemId).then(() => { this.fetchItem(this.itemId).then(() => {
loadingInstance.isLoading = false; loadingInstance.isLoading = false;
}); });
// Get attachments
this.fetchAttachments(this.itemId).then((result) => {
this.$console.log( result, 'attachments' );
});
} }
} }