Vue 子组件接收父组件的值

1.父组件
<template>
<div id="rightmenu8">
<rightmenu7 ref="rightmenu7" @child="parent3" :age="age"></rightmenu7> 
</div>
</template>
<script>
import rightmenu7 from "./RightMenu7.vue";
export default {

 

name: "rightmenu8",
data() {
return {
    age:18
}
},
methods: {
},
components: {
rightmenu7: rightmenu7
}
};
</script>
 
2.子组件
   
<template>
<div id="rightmenu7" ></div>
</template>
<script>
export default {
props:['age'],
name:"rightmenu7",
data(){
return{
}
}
}
</script>

<style>

</style>
posted @ 2018-04-13 09:08  ZBB0304  阅读(1064)  评论(0编辑  收藏  举报