Skip to content

Commit

Permalink
revert: "refactor: remove unnecessary nextTick"
Browse files Browse the repository at this point in the history
This reverts commit 8537ebb.
A regression in SSR apps was introduced.
  • Loading branch information
NamesMT committed Aug 6, 2024
1 parent 8005b61 commit 5eedee0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ModernCropper.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { CropperOptions } from 'cropperjs'
import Cropper from 'cropperjs'
import { onMounted, reactive, ref, toRefs, watch } from 'vue'
import { nextTick, onMounted, reactive, ref, toRefs, watch } from 'vue'
import type { SetNonNullable } from 'type-fest'
export interface PassThroughOptions {
Expand Down Expand Up @@ -86,7 +86,9 @@ function onCropperMounted(hook: CropperHook) {
hooksList.push(hook)
}
onMounted(() => {
onMounted(async () => {
await nextTick()
cropper.value = new Cropper(document.getElementById(id) as HTMLImageElement, passThrough?.cropper?.constructOptions)
image.value = cropper.value.getCropperImage()
canvas.value = cropper.value.getCropperCanvas()
Expand Down

0 comments on commit 5eedee0

Please sign in to comment.