vue-scrollto icon indicating copy to clipboard operation
vue-scrollto copied to clipboard

Not working with Nuxtjs

Open aheadfullofcode opened this issue 5 years ago • 3 comments
trafficstars

Hi,

Nuxt Version: v2.13.0

I can't figure out how to get this working with Nuxt JS.

I've imported the module as stated in the docs.

modules: [ 'vue-scrollto/nuxt', ]

My markup in my component is as follows:

<a href="#" v-scroll-to="'#' + navItem" v-html="navItem" />

As a result, I get the following error and the scroll doesn't work at all.

vue.runtime.esm.js?2b0e:619 [Vue warn]: Failed to resolve directive: scroll-to

Am I missing a step? I am trying to apply the module to a list of LI's, should that cause issues? I think it's a pretty standard use case.

Thanks in advance

aheadfullofcode avatar Jun 26 '20 14:06 aheadfullofcode

Same here

bc010101 avatar Jul 08 '20 00:07 bc010101

Hello,

I use that with Nuxt.js and work for me.

modules: [ "vue-scrollto/nuxt", ],

<nav> <ul> <li v-for="nav in navs" :key="nav.id" :class="[name, { active: nav.active }]" > <a v-scroll-to="{ el: nav.anchor, duration: 750, easing: 'ease-out', }" href="#" >{{ nav.name }}</a > </li> </ul> </nav>

nav.anchor return String for an example for me nav.anchor return "#services".

And add your ID anchor on your container you want to scroll to.

RemiTiab avatar Nov 21 '20 13:11 RemiTiab

Hello,

I use that with Nuxt.js and work for me.

modules: [ "vue-scrollto/nuxt", ],

<nav> <ul> <li v-for="nav in navs" :key="nav.id" :class="[name, { active: nav.active }]" > <a v-scroll-to="{ el: nav.anchor, duration: 750, easing: 'ease-out', }" href="#" >{{ nav.name }}</a > </li> </ul> </nav>

nav.anchor return String for an example for me nav.anchor return "#services".

And add your ID anchor on your container you want to scroll to.

This worked well for me. Thanks, @RemiTiab!

jstrother avatar Dec 23 '20 05:12 jstrother