Skip to content

Commit 20329da

Browse files
committed
fix: replace exposed site header method with nav link emitter
1 parent a0d14e1 commit 20329da

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

components/navbar.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ const props = defineProps({
3232
}
3333
})
3434
35-
const instance = getCurrentInstance()
35+
const emit = defineEmits(['nav-link-click'])
3636
3737
// ===================================================================== Methods
3838
const scrollToSection = async (el) => {
39-
instance.parent.exposed.handleNavClick()
39+
emit('nav-link-click')
4040
const id = el.replaceAll('#', '')
4141
const section = document.getElementById(id)
4242
if (section) {

components/site-header.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
<div class="mobile-nav">
1212
<Navbar
1313
:links="navigation"
14-
class="mobile">
14+
class="mobile"
15+
@nav-link-click="handleNavClick">
1516
<div class="nav-item">
1617
<ButtonCta
1718
tag="nuxt-link"
@@ -169,8 +170,6 @@ const handleNavClick = () => {
169170
if (navigationOpen.value) { toggleNav() }
170171
}
171172
172-
defineExpose({ handleNavClick })
173-
174173
</script>
175174

176175
<style lang="scss" scoped>

0 commit comments

Comments
 (0)