You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
589 B
Vue
27 lines
589 B
Vue
3 years ago
|
<template>
|
||
|
<div style="background:gold;margin: 20px;">
|
||
|
<div style="cursor:pointer" @click="title='这是父组件传递过去的'">点击重置父组件title:{{title}}</div>
|
||
|
<Child :title="title" @updateTiTle="updateTiTle"></Child>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import Child from './Child.vue';
|
||
|
export default {
|
||
|
name:'Parent',
|
||
|
components:{
|
||
|
Child
|
||
|
},
|
||
|
data(){
|
||
|
return{
|
||
|
title:'这是父组件传递过去的'
|
||
|
}
|
||
|
},
|
||
|
methods:{
|
||
|
updateTiTle(title){
|
||
|
this.title = title
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
</script>
|