remove scroll behavior
This commit is contained in:
parent
6bfbc01fce
commit
3b2e92e2b5
|
@ -3,14 +3,6 @@ const config = useRuntimeConfig()
|
||||||
const apiBase = config.public.apiBase
|
const apiBase = config.public.apiBase
|
||||||
|
|
||||||
const { data: pagesData } = await useFetch<ApiPagesType[]>(`${apiBase}/pages/?ordering=order`)
|
const { data: pagesData } = await useFetch<ApiPagesType[]>(`${apiBase}/pages/?ordering=order`)
|
||||||
const { scrollToAnchor, scrollToTop } = useAnchorScroll({
|
|
||||||
toTop: {
|
|
||||||
scrollOptions: {
|
|
||||||
behavior: 'smooth',
|
|
||||||
offsetTop: 0,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
@ -24,7 +16,7 @@ const route = useRoute()
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<template v-for="item in pagesData">
|
<template v-for="item in pagesData">
|
||||||
<NuxtLink :to="item.external_link || ((route.name == 'index' ? '' : '/') + `#${item.slug}`)"
|
<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 }}
|
{{ item.menu_title }}
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</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