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

721
Vistas
Vuejs - $slots have 'el' is null

WHen I access Vuejs $slots instance I get el = null but type = "div"

template:

  <slot name="head">
    <h1>
      {{ text }}
    </h1>
  </slot>

script

  ...
  const slotCont = this.$slots.head();
  console.log(slotCont[0]);

the .el is null event though we've added sd

parent

<custom-component :key="human.id">
    <template #head>
      <div style="display: flex;">
        this is Head
      </div>
    </template>

    <template #default>
     <h1>Head</h1>
    </template>
</custom-tooltip>

console.log

anchor: null
appContext: null
children: (2) [{…}, {…}]
component: null
dirs: null
dynamicChildren: null
dynamicProps: null
el: null <-- element is null
...
type: "div" <-- div is passed

Error: Cannot read properties of undefined (reading 'el')

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

0

vm.$slots and vm.$scopedSlots refers to slot inputs passed to the component.

So if you didn't provided any <template #head> in your component, it won't appear inside these properties.

AFAIK, you can't access the default slot from the vm object, Vue renders it as if it was not even in a slot in the first place. You'll need to query that element in a different way.

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