Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!