Add ids to some buttons
Former-commit-id: 20c0f70776847e655516225044c208ed5757b2b8 [formerly d53bf61e15b860ea089c7a615190d6414c80d48a] [formerly 81022384e3a5057961c691f4099f9980f93bcd12 [formerly 2d9caaec4a01b64c0f4f762c200e00f525946dd5]] Former-commit-id: f3f07876ffc578eaec86c81b452fa1f3783aec18 [formerly ec550918fcf18507073c01481581b4a70059cbe7] Former-commit-id: d9adac0236fcf450c3b1d4b3eb523cf6285ca552
This commit is contained in:
35
_assets/src/components/buttons/Download.vue
Normal file
35
_assets/src/components/buttons/Download.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<button @click="download" aria-label="Download" title="Download" class="action" id="download-button">
|
||||
<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>
|
||||
Reference in New Issue
Block a user