filebrowser/_assets/src/components/buttons/Download.vue
Henrique Dias 007e1a63c0 Remove id from not needed elements
Former-commit-id: d69ab4b48daff97db9ea91ccd2341f07c2ae89de [formerly bba6e08f3d96f251bdfb51a88b1e03c3ce2f32f0] [formerly 8d5d2dd9b3b2fa702c4b7831821c79912bb2f470 [formerly 5291e71132874ba22d6f859f52974007fd717acb]]
Former-commit-id: d30c056123fa2bc60519f45d8ba5a7151c0ff726 [formerly 8acf445e82c01881d7129489b68a7520c415bb8a]
Former-commit-id: b43f8a1301fa55506c6d0e22b91d395957275d39
2017-07-04 17:48:09 +01:00

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>