I can't get velocity.js to work with nuxt, using it as a plugin with ssr false but no luck there.
Error is "render function or template not defined in component: anonymous"
-> nuxt.config.js
plugins: [{
src: '~/plugins/vue-carousel',
ssr: false
}, {
src: '~/plugins/velocity',
ssr: false
}],
-> plugins/velocity.js
import Velocity from 'velocity-animate'
export {
Velocity
}
-> my component
<script>
import _ from 'lodash'
import axios from 'axios'
import Velocity from '~/plugins/velocity'
export default {
data() {
return {
options: [],
}
},
methods: {
beforeEnter: function(el) {
el.style.opacity = 0
el.style.height = 0
},
enter: function(el, done) {
var delay = el.dataset.index * 150
setTimeout(function() {
Velocity(
el,
{ opacity: 1, height: '1.6em' },
{ complete: done }
)
}, delay)
},
leave: function(el, done) {
var delay = el.dataset.index * 150
setTimeout(function() {
Velocity(
el,
{ opacity: 0, height: 0 },
{ complete: done }
)
}, delay)
}
}
</script>
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1385">#c1385</a>)</em></sub></div>