instance code:
parent component:
<div class="parent">
</div>
<script>
data(){
return{
id:this.$route.query.id
}
}
</script>
Sub-component:
<div class="children">
</div>
<script>
data(){
return{
id:this.$parent.id
}
}
</script>
Why can"t you get the id of the parent component by writing like this