Former-commit-id: 229baefa76ee3202dcf4aac3249a461b6cc51eed [formerly 2773046c33eee1ff79ef1d02238de37e14860726] [formerly 2d50f10c3f809c6135cc861eaf0360092a23ea3f [formerly 14ff4f2b74c440888b632a6bacd338067dd0b588]] Former-commit-id: e766887e65390514cf827700c3ab0d5ed000c480 [formerly 7429be72884d3eb154e45dc638fd17dfcfdfaa62] Former-commit-id: d23373bf316295d6579e4bbc780f5b963c632c4d
36 lines
846 B
Vue
36 lines
846 B
Vue
<template>
|
|
<button @click="download" aria-label="Download" title="Download" class="action">
|
|
<i class="material-icons">file_download</i>
|
|
<span>Download</span>
|
|
<span v-if="selectedCount > 0" class="counter">{{ selectedCount }}</span>
|
|
</button>
|
|
</template>
|
|
|
|
<script>
|
|
import {mapGetters, mapState} from 'vuex'
|
|
import api from '@/utils/api'
|
|
|
|
export default {
|
|
name: 'download-button',
|
|
computed: {
|
|
...mapState(['req', 'selected']),
|
|
...mapGetters(['selectedCount'])
|
|
},
|
|
methods: {
|
|
download: function (event) {
|
|
if (this.req.kind !== 'listing') {
|
|
api.download(null, this.$route.path)
|
|
return
|
|
}
|
|
|
|
if (this.selectedCount === 1) {
|
|
api.download(null, this.req.items[this.selected[0]].url)
|
|
return
|
|
}
|
|
|
|
this.$store.commit('showHover', 'download')
|
|
}
|
|
}
|
|
}
|
|
</script>
|