advanced-cropper / vue-advanced-cropper

The advanced vue cropper library that gives you opportunity to create your own croppers suited for any website design
https://advanced-cropper.github.io/vue-advanced-cropper/
Other
977 stars 132 forks source link

Missing Typescript example #163

Closed christher-lenander closed 1 year ago

christher-lenander commented 2 years ago

Your examples don't work out of the box when using Vue 3 and Typescript.

Norserium commented 2 years ago

@ChristherLenander, hello! What's exactly goes wrong or is not clear? Due to a weak typing it's pretty easy to use the examples from the documentation. I suppose only the cropper refs are able to make some troubles.

Norserium commented 2 years ago

@ChristherLenander, any news?

Norserium commented 2 years ago

@DannyFeliz, do you have the same issue? Could you give me some details?

hi-reeve commented 2 years ago

got the same issues, there is not type for cropperRef element so there is no possible way to call getResult() from cropperRef element on composition api

Norserium commented 2 years ago

@zynth17, I were not sure that it should be documented. It looks like the common Vue 3 practice:

const cropperRef = ref<InstanceType<typeof Cropper>>();

if (cropperRef.value) {
   const result = cropperRef.value.getResult();
}

It is described in the official documentation.

hi-reeve commented 2 years ago

@zynth17, I were not sure that it should be documented. It looks like the common Vue 3 practice:

const cropperRef = ref<InstanceType<typeof Cropper>>();

if (cropperRef.value) {
   const result = cropperRef.value.getResult();
}

It is described in the official documentation.

thanks! totally forgot can do this.