Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on zoomIn() and zoomOut() #38

Open
adiandroo opened this issue Jan 26, 2023 · 1 comment
Open

Error on zoomIn() and zoomOut() #38

adiandroo opened this issue Jan 26, 2023 · 1 comment

Comments

@adiandroo
Copy link

adiandroo commented Jan 26, 2023

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;" >
</v-zoomer>
<div class="fixed hidden lg:flex flex-row bottom-16 space-x-2 place-items-center">
<button class="rounded-full h-10 w-10 flex items-center justify-center bg-grey-60 text-white text-2xl" @click="$refs.zoomer?.zoomIn()">
+
</button>
<button class="rounded-full h-10 w-10 flex items-center justify-center bg-grey-60 text-white text-2xl" @click="($refs.zoomer?.zoomOut())">
-
</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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants