VUE2 passing parameter from child to parent

Viewed 2980

how do i properly pass parameter from child to parent with an $emit function? here what i have done

HTML

<lista-servizi-gialla :servizi="modello" v-on:centramappa="mappaCenter(x,y,selected)"></lista-servizi-gialla>

COMPONENT

template'
<span class="pull-right forward"
 v-on:click="centraNellaMappa(single.x,single.y,single.selected)"></span>',

methods:{
    centraNellaMappa : function(x,y,selected){
        this.$emit('centramappa',[x],[y],[selected]);
     }  
}

PARENT FUNCTION

mappaCenter : function(x,y,selected){
    alert(x);
}   

the 'x' parameter seems not being recognized

1 Answers
Related