Closed craigyu closed 6 years ago
Hi, I tried your example but it still doesn't work. Here's the code in my index.js
import Scrollspy from 'vue2-scrollspy';
Vue.use(Scrollspy);
export default new Vue({
el: '#root',
store: store,
router:router,
render: h => h(foo)
});
And here's the code in my component:
<div class="catalogue">
<a @click="$scrollTo(0)" v-for="aCat in cataArr" v-bind:key="aCat">
<div class="each-cat"
:class="{active:scrollPos == 0}">
{{aCat}}
</div>
</a>
</div>
<div class="items-wrapper" :v-scroll-spy="scrollPos">
<div class="each-cat-item" v-if="formatCats.length>0" v-for="aCat in formatCats" v-bind:key="aCat">
{{aCat}}
</div>
</div> ...
version of Vue?
@ibufu On Vue 2.8.2 facing this issue too.
same issue here
sorry I forgot to reply, i was on vue 2.3.4, i ended up using vue-scrollactive
@Huixiong91 I am confused that my demo works on the latest Vue(2.4.4).
https://ibufu.github.io/vue2-scrollspy/ I printed the version of Vue in console.
@ibufu i encountered the same problem, the vue version is the same as yours.The problem is that the the related data is got with ajax.
you should use this.$scrollTo
Was this resolved. I can not get it to work either.
Hi, I'm using this inside a vue component, when I click my tab that has <a @click="$scrollTo(0)">, the console says $scrollTo is not defined.
I tried to put
import Scrollspy from 'vue2-scrollspy'; Vue.use(Scrollspy);
in either the vue component or index.js, and nothing works.I'm new to vueJs, thanks for the help!