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

113
Visualizações
How can I output the <template /> tag to the DOM in Vue.js

I have a custom library built on Stencil that I need to integrate with Vue, and this library relies on the browser's <template /> tag.

For example, I need to render the following code to the dom:

<my-custom-list>
  <template>
    <my-custom-title></my-custom-title>
    <my-custom-description></my-custom-description>
  </template>
</my-custom-list>

my-custom-list will then get whatever is inside the template and use it for each of the items in the list.

I managed to get it to work by using the v-html directive, for example:

<my-custom-list v-html="<template><my-custom-title></my-custom-title><my-custom-description></my-custom-description></template>">
</my-custom-list>

However, I would also like to be able to use Vue components inside this template tag, like:

<my-custom-list>
  <template>
    <my-custom-title></my-custom-title>
    <my-custom-description></my-custom-description>
    <custom-vue-component></custom-vue-component>
  </template>
</my-custom-list>

Some old answers online suggest using the is directive to be able to output the template tag, like <div is="template"> but that has been deprecated.

I am not even sure if this is possible, but any insights would be much appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use the v-pre directive to skip compilation for parts of your components.

<my-custom-list v-pre>
  <template>
    <my-custom-title></my-custom-title>
    <my-custom-description></my-custom-description>
    <custom-vue-component></custom-vue-component>
  </template>
</my-custom-list>
about 4 years ago · Juan Pablo Isaza Relatório
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