Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

114
Vistas
Passing slots in h() render function in Vue3

I'm a bit confused on how to convert this template to an h() function in Vue 3

<n-tooltip trigger="hover">
 <template #trigger>
 <n-button> Duck </n-button>
 </template>
 If it looks like a duck, walks like a duck, and quacks like a duck...it must
 be a duck.
</n-tooltip>

I've tried this but I know I'm doing something wrong

 return h(NTooltip, { trigger: 'hover' } ,
   [h('template' , null ,  { trigger: () => h(NButton,'Duck') } ),
   h('p','If it looks like a duck, walks like a duck, and quacks like a duck...it must be a duck')] )

Any help is really appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

  • h('template') is not needed for template tags, just return the content inside the object (of the 3 param)
  • the child is default slot so it should be declared as such (default:)
  • and the p is not in the template example, and you don't need it in the render function either, just return the text
return h(
  NTooltip,
  { trigger: 'hover' } ,
  {
    trigger: () => h(NButton,'Duck'),
    default: () => 'If it looks like a duck, walks like a duck, and quacks like a duck...it must be a duck'
  }
)

more info at: https://vuejs.org/guide/extras/render-function.html#passing-slots

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda