Production #13
|
@ -3,14 +3,6 @@ const config = useRuntimeConfig()
|
|||
const apiBase = config.public.apiBase
|
||||
|
||||
const { data: pagesData } = await useFetch<ApiPagesType[]>(`${apiBase}/pages/?ordering=order`)
|
||||
const { scrollToAnchor, scrollToTop } = useAnchorScroll({
|
||||
toTop: {
|
||||
scrollOptions: {
|
||||
behavior: 'smooth',
|
||||
offsetTop: 0,
|
||||
}
|
||||
},
|
||||
})
|
||||
const route = useRoute()
|
||||
</script>
|
||||
<template>
|
||||
|
@ -24,7 +16,7 @@ const route = useRoute()
|
|||
<div class="menu">
|
||||
<template v-for="item in pagesData">
|
||||
<NuxtLink :to="item.external_link || ((route.name == 'index' ? '' : '/') + `#${item.slug}`)"
|
||||
:target="item.external_link ? '_blank' : '_self'" @click.native="scrollToAnchor(item.slug)" event="">
|
||||
:target="item.external_link ? '_blank' : '_self'">
|
||||
{{ item.menu_title }}
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
nuxtApp.$router.options.scrollBehavior = (to, from, savedPosition) => {
|
||||
if (to.hash) {
|
||||
return { el: to.hash,behavior: 'smooth', }
|
||||
}
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue