Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

203
Vistas
Vue 3 - Emit in reusable / composable file

I want to use emit in my following file: useGoo.ts

import Swal from "sweetalert2/dist/sweetalert2.js";

export default function useModal() {

  const { emit } = getCurrentInstance();

  function myId() {
    emit('id', '123')
  }

}

But the emit does not work ofcourse. Can't get it working. Error:

Property 'emit' does not exist on type 'ComponentInternalInstance | null'
7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As I'm using TypeScript. The solution is as following: const { emit } = getCurrentInstance() as any;

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos