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

221
Vistas
How can i pass parametres from vue function in component?

I've to call a function with parametres but i didn't find a correct solution for my problem. The NavigateTo should pass a String value to my index to switch it and navigate to the correct component(no vue router).

Home.js

Vue.component('Home', {
    props: ['visible','logged'],
    data: function (){
        return{

        }
    },
    template: <a class="btn btn-primary display-4" on:click="NavigateTo(accedi)">Accedi</a>\n' 
    (only the button that call the function,i will post the rest of the code only if necessary)
    methods:{
        NavigateTo:function(destination){
            this.$emit('transit-inner', destination);
        }
    }
});

Index.js

<section id="Home" style="margin-top: 60px">
    <Home v-bind:visible="visible" v-bind:logged="session_info" v-on:transit-inner="goto()"></Home>
    <script>
        new Vue({
            el: '#Home',
            data:{
                visible: routes.visible_home,
                session_info: routes.status_session
            },
            methods:{
                goto: function (destination){
                    alert(destination);
                }
            }
        })
    </script>
</section>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You're using an Inline Event Handler (goto()) in your template:

<Home v-bind:visible="visible" v-bind:logged="session_info" v-on:transit-inner="goto()"></Home>

You've two options:

One, remove the ()

<Home v-bind:visible="visible" v-bind:logged="session_info" v-on:transit-inner="goto"></Home>

Or, provide the $event special variable if using Inline Handler

<Home v-bind:visible="visible" v-bind:logged="session_info" v-on:transit-inner="goto($event)"></Home>
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