父組件代碼
<template>
<div>
<comtest2 :name = "name"></comtest2>
</div>
</template>
<script>
import test02 from './test02.vue';
export default {
data() {
return {
name: "我的名字是test01"
}
},
methods:{
},
beforeMount(){
},
mounted(){
},
watch: {
},
components: {comtest2:test02},
}
</script>
<style>
</style>
子組件代碼
<template>
<div>
{{name}}
</div>
</template>
<script>
// import animated from 'animate.css'
export default {
data() {
return {
}
},
methods:{
},
beforeMount(){
},
mounted(){
console.log(this.name)
},
watch: {
},
props: ['name'],
}
</script>
<style>
</style>