Skip to content

Commit

Permalink
Update init image by croppa
Browse files Browse the repository at this point in the history
  • Loading branch information
hr20k committed Nov 23, 2019
1 parent 2adac20 commit 5f66e2f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions frontend/src/components/ItemDetailModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
:placeholder-font-size="10"
:file-size-limit="4000 * 6000"
accept=".jpg,.jpeg,.png"
@initial-image-loaded="imageLoaded"
@file-size-exceed="$message.error('ファイルサイズが大きすぎます')"
>
</croppa>
Expand Down Expand Up @@ -128,9 +129,10 @@ export default {
image.setAttribute('crossorigin', 'anonymous')
image.src = item.url
this.initialImage = image
image.onload = () => {
this.imageHeight = image.height / this.quality
try {
this.croppa.refresh()
} catch {
console.log('refresh error.')
}
}
this.tags = item.tags.map(tag => tag.name)
Expand All @@ -143,6 +145,9 @@ export default {
}
},
methods: {
imageLoaded () {
this.imageHeight = this.croppa.img.height / this.quality
},
handleClose (tag) {
this.tags.splice(this.tags.indexOf(tag), 1)
},
Expand Down

0 comments on commit 5f66e2f

Please sign in to comment.