Overriding the default TheHeader.view component does not work
See original GitHub issueVersion
@nuxt/content-theme-docs": “^0.8.0”, “nuxt”: “^2.14.7”,
Reproduction Link
Steps to reproduce
- yarn
- yarn dev
What is Expected?
TheHeader.vue Component Should be working.
<template>
<header
class="sticky top-0 left-0 right-0 z-30 bg-light-elevatedSurface dark:bg-dark-elevatedSurface h-16 lg:h-24 transition-colors duration-300 ease-linear"
:class="{ shadow: !onTop, 'shadow-reverse': onTop }"
>
<div
class="container relative mx-auto px-4 flex items-center justify-between lg:py-6 h-full"
>
<NuxtLink to="/">
<img v-if="$config.logo" class="h-10 max-w-full" :src="$config.logo" />
<template v-else-if="$config.logoLight && $config.logoDark">
<img
:src="$config.logoLight"
class="h-10 max-w-full light-img"
height="100"
/>
<img
:src="$config.logoDark"
class="h-10 max-w-full dark-img"
height="100"
/>
</template>
<AppLogo
v-else-if="$options.components['AppLogo']"
class="text-light-onSurfacePrimary dark:text-dark-onSurfacePrimary transition-colors duration-300 ease-linear"
/>
</NuxtLink>
<div v-if="$config.showSocialIconsOnHeader" class="dark:text-white flex">
<a
v-if="$config.linkedinUsername"
:href="`https://www.linkedin.com/in/${$config.linkedinUsername}`"
target="_blank"
class="hidden sm:block ml-3"
rel="noopener"
aria-label="linkedin"
>
<IconLinkedin class="w-6 h-6" />
</a>
<a
v-if="$config.twitterUsername"
:href="`https://twitter.com/${$config.twitterUsername}`"
target="_blank"
class="hidden sm:block ml-8"
rel="noopener"
aria-label="twitter"
>
<IconTwitter class="w-6 h-6" />
</a>
<a
v-if="$config.githubOwner"
:href="`https://github.com/${$config.githubOwner}`"
target="_blank"
class="hidden sm:block ml-3"
rel="noopener"
aria-label="github"
>
<IconGithub class="w-8 h-8" />
<a
v-if="$config.githubOwner"
:href="`https://github.com/${$config.githubOwner}`"
target="_blank"
class="hidden sm:block ml-3"
rel="noopener"
aria-label="github"
>
<IconGithub class="w-8 h-8" />
</a>
</div>
</div>
</header>
</template>
<script>
export default {
data() {
return {
onTop: true,
}
},
mounted() {
window.addEventListener('scroll', this.handleScroll)
},
destroyed() {
window.removeEventListener('scroll', this.handleScroll)
},
methods: {
handleScroll() {
this.onTop = window.pageYOffset < 60
},
},
}
</script>
What is actually happening?
TheHeader.vue Component Not Working
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
View Component as a Tag Helper does not get Invoked
I'm using ASP.NET Core 1.1 and the View Components without Tag Helpers are working fine. I also followed MSDN's official tutorial, “Invoking View...
Read more >Considerations for Overriding Standard Buttons
Before you override a standard button, review these considerations.Required Editions and User Permissions Available in: Salesforce Classic (not available...
Read more >Configuring the header bar - React Navigation
A screen component can have a static property called navigationOptions ... The default or previous options that would be used if new values...
Read more >Drupal 8 - Override template with module
twig with the header section commented out and put that file in modules/my_module/templates, but I don't quite understand where I'm supposed to ...
Read more >ASP.NET Core Blazor layouts - Microsoft Learn
Layouts solve these problems. ... Specifying the layout directly in a component overrides a default layout: ... The header ( <header>.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone looking how to override components of the theme:
So basically, you need to create a
components/
folder in the root of your project. Inside it, add the components you want to override with the same name as the original (ignore sub-directories). For example,components/AppNav.vue
will override theAppNav.vue
component of the theme.In your
nuxt.config.js
file:To clarify, TheHeader.vue is not displaying two Github links as per the code