jarvisniu / vue-zoomer

Zoom the image or other thing with mouse or touch
MIT License
150 stars 36 forks source link

Error on zoomIn() and zoomOut() #38

Open adiandroo opened 1 year ago

adiandroo commented 1 year ago

I use the v-zoomer for zoom in and zoom out image. The code is like this:

` <v-zoomer ref="zoomer" class="zoomer-container" :zoomed.sync="zoomed"

<img :src="${previewProduct}" :alt="title" style="width: 100%; height: 100%; object-fit: cover;"

</button> </div>

But it got error on $refs.zoomer?.zoomIn() & $refs.zoomer?.zoomOut(). When I click button that run zooomIn and zoomOut. It gives error on linter 'Property 'zoomIn' does not exist on type 'Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>> | Element | (Vue<...> | Element)[]'. Property 'zoomIn' does not exist on type 'Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>'.ts(2339)' and when I use to click on development, it gives error instrument.js?ea14:109 [Vue warn]: Error in v-on handler: "TypeError: _vm$$refs$zoomer.zoomIn is not a function". I'm using Vue.js with TypeScript

shayanbahrampour commented 2 weeks ago

try $refs.zoomer[0].zoomIn() instead.