vuescrolltoを使ってメニューバーのAboutページからTopページにある#の任意の場所に飛ばずエラーが出てしまいます。
どなたかご教示いただけると幸いです。
<nav>
<ul class="md:flex md:justify-end md:items-end">
<li v-for="(item, index) in lists" :key="index">
<a v-scroll-to="item.elementLink" :href="item.link">{{ item.txt }}</a>
<p>{{ item.isClass }}</p>
</li>
</ul>
</nav>
...省略...
data () {
return {
lists: [
{
link: '/about/',
txt: 'About',
elementLink: ''
},
{
link: '../#service_content_wrap',
txt: 'Service',
elementLink: '#service_content_wrap'
},
///scroll.js///↓
import Vue from 'vue'
Vue.directive('scroll', {
inserted (el, binding) {
const f = function (evt) {
if (binding.value(evt, el)) {
window.removeEventListener('scroll', f)
}
}
window.addEventListener('scroll', f)
}
})