Automatically jumps to the next photo when deleting while previewing.
This commit is contained in:
parent
dcbc3286e2
commit
f8b5e869fd
@ -136,6 +136,7 @@ export default {
|
|||||||
window.addEventListener('keyup', this.key)
|
window.addEventListener('keyup', this.key)
|
||||||
this.$store.commit('setPreviewMode', true)
|
this.$store.commit('setPreviewMode', true)
|
||||||
this.listing = this.oldReq.items
|
this.listing = this.oldReq.items
|
||||||
|
this.$root.$on('preview_deleted', this.deleted)
|
||||||
this.updatePreview()
|
this.updatePreview()
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
@ -143,6 +144,19 @@ export default {
|
|||||||
this.$store.commit('setPreviewMode', false)
|
this.$store.commit('setPreviewMode', false)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
deleted (path) {
|
||||||
|
|
||||||
|
let pieces = path.split('/')
|
||||||
|
let deletedName = decodeURIComponent(pieces[pieces.length - 1])
|
||||||
|
|
||||||
|
this.listing = this.listing.filter(item => item.name !== deletedName)
|
||||||
|
|
||||||
|
if (this.hasNext) {
|
||||||
|
this.next()
|
||||||
|
} else {
|
||||||
|
this.back()
|
||||||
|
}
|
||||||
|
},
|
||||||
back () {
|
back () {
|
||||||
this.$store.commit('setPreviewMode', false)
|
this.$store.commit('setPreviewMode', false)
|
||||||
let uri = url.removeLastDir(this.$route.path) + '/'
|
let uri = url.removeLastDir(this.$route.path) + '/'
|
||||||
|
|||||||
@ -20,7 +20,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import {mapGetters, mapMutations, mapState} from 'vuex'
|
import {mapGetters, mapMutations, mapState} from 'vuex'
|
||||||
import { files as api } from '@/api'
|
import { files as api } from '@/api'
|
||||||
import url from '@/utils/url'
|
|
||||||
import buttons from '@/utils/buttons'
|
import buttons from '@/utils/buttons'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -39,7 +38,8 @@ export default {
|
|||||||
if (!this.isListing) {
|
if (!this.isListing) {
|
||||||
await api.remove(this.$route.path)
|
await api.remove(this.$route.path)
|
||||||
buttons.success('delete')
|
buttons.success('delete')
|
||||||
this.$router.push({ path: url.removeLastDir(this.$route.path) + '/' })
|
|
||||||
|
this.$root.$emit('preview_deleted', this.$route.path)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user