Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

357
Visualizações
Nuxt.js head() inside error layout not working when using in fetch() hook at SSR

When we throw Nuxt error function in new fetch() hook with this.$nuxt.error() syntax, the title of error page which is not found is not applied in browser when using SSR (e.g: refreshing index page) and the title is empty (or its the same as defined in nuxt.config.js). But it works when on client side (e.g: switching between routes)

/layouts/error.vue

<template>
  <div>404 not found!</div>
</template>

<script>
export default {
  head() {
    return {
      title: "not found",
    };
  },
};
</script>

/pages/index.vue

<template>
  <div />
</template>

<script>
export default {
  fetch() {
    this.$nuxt.error({
      statusCode: 404,
      message: "Page not found",
    });
  },
};
</script>

Is it a bug or I miss something?

Codesandbox sample project link

Nuxt.js version: 2.15.8

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda