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

151
Vistas
Vue js submit function

There is code to handle the button to close the page and initialize submit

window.onbeforeunload = function(e) {
  var dialogText = 'Dialog text here';
  e.returnValue = dialogText;
  return dialogText;
};

How to use JavaScript to process this function in Vue JS to send the form through HTML tags? I did similar things on Jinja, but I can specify data directly in the URL

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

0

You need to bind that function to the beforeunload window event when the component is initialized.

Example:

mounted() {
    window.addEventListener("beforeunload", this.unload);
},

methods: {
    unload(e) {
        var dialogText = 'Dialog text here';
        e.returnValue = dialogText;
        return dialogText;
    }
}

Alternatively, if you're using the form element with a submit function, you could just call unload() directly? Hard to know whether that would simplify the solution without seeing more of your code.

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