• Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Precios
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

178
Vistas
Nuxt add raw (static) html to a component

In examples like this we have the v-html directive to dynamically render the raw html into the dom. I am in need of a way to insert a raw script before the entire lifecycle begins its magic. This is because I am working with a macro (auth0).

<!doctype html>
<html lang="en" data-n-head="...">
<head>...nuxt generated head...</head>
<script>
    // this tag needs to exist as html when building with 'yarn generate'
    // @@config@@ is a macro
    let config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@'))));
</script>
<body>
 ... nuxt generated body ...
</body>

In essence, when I run the command yarn generate I would like a specific page (pages/login/index.html) to have this specific tag to exist and not injected during vue's lifecycle. There are alternate solutions like having scripts automatically postprocessing the static page output, but I'm hoping that there is a way to accomplish this without such complications.

My nuxt version is 2.15.8

9 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.