Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!