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

101
Visualizações
How to define properties in nested Vue3 compiling dynamic-html?

I'm trying to use Vue compiler to render dynamic HTML texts; I have implemented this component:

app.component("dyno-html", {
  props: ["htmlTxt"],
  setup(props) {
    const textCompRef = computed(() => ({ render: compile(props.htmlTxt) }));
    return () => h(textCompRef.value);
  },
});

I have succeeded in doing so, in one level. Like the code below, and it works fine.

<template>
  <div class="home">
    <dyno-html :htmlTxt="htmlTest"></dyno-html>
  </div>
</template>

<script>
export default {
  name: "Home",
  components: {},
  data: function() {
    return {
      htmlTest: "<H1>Test</H1>",
    }
  }
}
</script>

I'm trying to add a second layer in a nested manner:

htmlTest: "<h1>Test</h1><dyno-html :htmlTxt='htmlTest2'></dyno-html>",
htmlTest2: "<h2>Test2</h2>",

I get this warning:

[Vue warn]: Property "htmlTest2" was accessed during render but is not defined on instance.

Resulting into the error:

Uncaught (in promise) TypeError: template is undefined

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