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

148
Vistas
How to receive data in root component with method?

I want to understand how Vue works. What I am trying approach is simply to receive number '1' with method in Vue. Code execution gives me 'undefined'. Why?

<div id="form">
    <button v-on:click="submitProduct">Save</button>
</div>
<script>
    var someForm = Vue.createApp ({
    methods: {
        submitBtn: function(){
            someForm.showdata
        },
        showData: function(){
            return 1
        }
    }
})
</script>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try to assign the returned data to a variable then show it using alert or console.log a,d use this instead of someForm:

    var someForm = Vue.createApp ({
    methods: {
        submitBtn: function(){
          let data=  this.showData();
           alert(data);
        },
        showData: function(){
            return 1
        }
    }
})
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