From my parent component I use a router-view
to render the child views, in vue 2 use $this.refs.child...
it served to access the data and functions of my view, but in Vue 3 not, how can I access this data?
In the official documentation it says that the ref
can be used as follows
<script>
export default {
setup()
{
const timeLine = ref({});
const routerView = ref(null);
onMounted(() =>
{
console.log(routerView.value.timeLine)
});
return { timeLine, routerView }
}
}
</script>
And my router-view is declared like this
<router-view
ref="routerView"
class="scroll scroll-design scroll-big"
>
</router-view>
But this way it doesn't work, I don't access the timeLine
property of my child component, which I have declared as follows
const timeLine = reactive(
{
show: true,
title: 'generals.evangelize',
back: 'mainHome',
width: '16.66'
});
How can I get this data from the parent component?