niclas_4
niclas_4

Reputation: 3674

Injecting Function in Nuxt

I try to inject a function inside my plugin

plugin.js

import Vue from 'vue'
import mediumZoom from 'medium-zoom'

Vue.prototype.$mediumZoom = mediumZoom()

When I try to load my page it keeps loading infinite and the page in the end doesnt react, it looks like this: enter image description here

Upvotes: 3

Views: 536

Answers (1)

dfsq
dfsq

Reputation: 193261

It's because you are calling mediumZoom on page load. You probably want:

Vue.prototype.$mediumZoom = mediumZoom
// don't call function, no () here ---^

Upvotes: 2

Related Questions