Seeking advice on passing data to components in VueJs. I am relatively new to VueJs and facing a challenge with two components. The issue arises when trying to display a component using the vuejs router that requires passing properties. Since the component is not a child of the parent component (located in a different directory), I am unsure how to pass the necessary data.
Illustrative example:
Parent component snippet:
<template>
<div class="container">
<router-link to="/Form"></router-link>
</div>
</template>
<script>
export default{
data(){
return{
values: {val1: 123, val2: 321}
}
}
}
</script>
Component requiring properties - Form component excerpt:
<template>
<div class="container">
<form>
<input type="text" v-model="values.val1"/>
<input type="number" v-model="values.val2"/>
</form>
</div>
</template>
<script>
export default{
props: {
values: {
type: Object
}
}
}
</script>