chore: files view dynamic component

This commit is contained in:
Ramires Viana
2021-03-01 16:12:17 +00:00
parent 057307181e
commit 7b6579ac8a
7 changed files with 107 additions and 106 deletions

View File

@@ -125,14 +125,12 @@ export default {
},
async mounted () {
window.addEventListener('keydown', this.key)
this.$store.commit('setPreviewMode', true)
this.listing = this.oldReq.items
this.$root.$on('preview-deleted', this.deleted)
this.updatePreview()
},
beforeDestroy () {
window.removeEventListener('keydown', this.key)
this.$store.commit('setPreviewMode', false)
this.$root.$off('preview-deleted', this.deleted)
},
methods: {
@@ -142,16 +140,11 @@ export default {
if (this.hasNext) {
this.next()
} else if (!this.hasPrevious && !this.hasNext) {
this.back()
this.close()
} else {
this.prev()
}
},
back () {
this.$store.commit('setPreviewMode', false)
let uri = url.removeLastDir(this.$route.path) + '/'
this.$router.push({ path: uri })
},
prev () {
this.hoverNav = false
this.$router.push({ path: this.previousLink })
@@ -171,7 +164,7 @@ export default {
} else if (event.which === 37) { // left arrow
if (this.hasPrevious) this.prev()
} else if (event.which === 27) { // esc
this.back()
this.close()
}
},
async updatePreview () {
@@ -239,6 +232,8 @@ export default {
}, 1500);
}, 500),
close () {
this.$store.commit('updateRequest', {})
let uri = url.removeLastDir(this.$route.path) + '/'
this.$router.push({ path: uri })
},