Skip to content

Commit

Permalink
append anchor node to body before click
Browse files Browse the repository at this point in the history
  • Loading branch information
shjryan committed Aug 26, 2019
1 parent a2dfecd commit 97ce659
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/Photo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ export default {
anchor.href = this.fullLocalImageURL
anchor.target = '_blank'
anchor.download = this.instance.name
anchor.style.visibility = 'hidden'
if (!document.body.contains(anchor)) {
document.body.appendChild(anchor)
}
anchor.click()
document.body.removeChild(anchor)
} else {
this.$store.commit('PhotoStore/loading', true)
readFile(this.instance.path).then(data => {
Expand All @@ -79,7 +84,12 @@ export default {
anchor.href = blob
anchor.target = '_blank'
anchor.download = this.instance.name
anchor.style.visibility = 'hidden'
if (!document.body.contains(anchor)) {
document.body.appendChild(anchor)
}
anchor.click()
document.body.removeChild(anchor)
})
})
}
Expand Down

0 comments on commit 97ce659

Please sign in to comment.