I am struggling to find the right solution for passing parameters to a function. I need to use NavigateTo to send a String value to my index in order to switch components without using 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 including the button that calls the function, additional code will be provided 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>