Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
Nuxt - Handle routes at runtime with ssr activated

Hello there: quick question I've

  • a Nuxt app with the target: 'server' in the nuxt.config.js
  • an API with an endpoint that give me, for a given path, a template associated ( eg: /person/maxime will give me template: PersonsSingle )
  • a vue component that handles this page ( eg: _pages/person.vue )

How can I handle this at runtime ? I guess it's something to do with the middlewares but which one and what is the best strategy here ?

PS: I use this system because two urls with the same structure (eg: /person/maxime and /person/sam could lead to two completely different templates ). Don't ask why I have to deal with it :/

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is how I would do it.

async asyncData({ $axios }) {
  const data = await $axios.$get('...')

  const templateType = data.templateType

  return {
    templateType
  }
}
<template>
  <div>
    <page-1 v-if="templateType === 'foo'" />

    <page-2 v-else />
  </div>
</template>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda