|
209 | 209 | </slot> |
210 | 210 | </div> |
211 | 211 | <div class="vac-image-file"> |
212 | | - <img ref="imageFile" :src="imageFile" /> |
| 212 | + <img ref="imageFile" :src="imageFile" @load="onImgLoad" /> |
213 | 213 | </div> |
214 | 214 | </div> |
215 | 215 |
|
@@ -478,22 +478,6 @@ export default { |
478 | 478 | messagesLoaded(val) { |
479 | 479 | if (val) this.loadingMessages = false |
480 | 480 | if (this.infiniteState) this.infiniteState.complete() |
481 | | - }, |
482 | | - imageFile() { |
483 | | - setTimeout(() => { |
484 | | - if (!this.$refs.imageFile) { |
485 | | - this.imageDimensions = null |
486 | | - setTimeout(() => this.resizeTextarea(), 0) |
487 | | - } else { |
488 | | - let height = this.$refs.imageFile.height |
489 | | - if (height < 30) height = 30 |
490 | | -
|
491 | | - this.imageDimensions = { |
492 | | - height: this.$refs.imageFile.height - 10, |
493 | | - width: this.$refs.imageFile.width + 26 |
494 | | - } |
495 | | - } |
496 | | - }, 20) |
497 | 481 | } |
498 | 482 | }, |
499 | 483 |
|
@@ -538,6 +522,15 @@ export default { |
538 | 522 | }, |
539 | 523 |
|
540 | 524 | methods: { |
| 525 | + onImgLoad() { |
| 526 | + let height = this.$refs.imageFile.height |
| 527 | + if (height < 30) height = 30 |
| 528 | +
|
| 529 | + this.imageDimensions = { |
| 530 | + height: this.$refs.imageFile.height - 10, |
| 531 | + width: this.$refs.imageFile.width + 26 |
| 532 | + } |
| 533 | + }, |
541 | 534 | async recordAudio() { |
542 | 535 | if (this.recorder.state === 'recording') { |
543 | 536 | this.recorder.stop() |
@@ -622,15 +615,18 @@ export default { |
622 | 615 | this.editedMessage = {} |
623 | 616 | this.messageReply = null |
624 | 617 | this.file = null |
| 618 | + this.imageDimensions = null |
625 | 619 | this.imageFile = null |
626 | 620 | this.emojiOpened = false |
627 | 621 | setTimeout(() => this.focusTextarea(disableMobileFocus), 0) |
628 | 622 | }, |
629 | 623 | resetImageFile() { |
| 624 | + this.imageDimensions = null |
630 | 625 | this.imageFile = null |
631 | 626 | this.editedMessage.file = null |
632 | 627 | this.file = null |
633 | 628 | this.focusTextarea() |
| 629 | + setTimeout(() => this.resizeTextarea(), 0) |
634 | 630 | }, |
635 | 631 | resetTextareaSize() { |
636 | 632 | if (!this.$refs['roomTextarea']) return |
|
0 commit comments