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

180
Visualizações
Is there any way to pass a DOM element as a prop in Vue 3?

I'm super new to Vue. While I don't normally do this, I think something like this would be possible in React + JSX (untested):

render() {
  const el = <p>Blah <a href="https://example.com">bloop</a> bleh</p>
  return (
    <div>
      <CustomReactComponent someProp={el}
    </div>
  )
}

Where CustomReactComponent would be able to render the element out of this.props.someProp.

Can I achieve this in Vue?


For the curious, my use case is similar to my very untested React example above. I would like some, but not all parent components of a common tiny component to pass in some text to display somewhere. Except I'd like to include links wherever I please, so I need <a> tags in there. I figured I could make that work by passing a whole <p> or <span> element as a prop.

Alternate solutions welcome!

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

0

As Estus said in their comment, this is what the slots feature is for.

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