<template>
    <div>
        <div>孙子2组件:{{obj.set}}</div>
        <div>孙子2组件:{{content}}</div>
        <el-button type="primary" @click="fun1">主要按钮</el-button>
        <p>测试:{{ pp }}</p>

    </div>
   </template>
   
   <script>
   import event from '@/views/test/event.js'
   export default {
    name: 'son2',
    provide(){ 
       // content:'传给子组件的内容'
       return {
        xdzj:this.xdzj
       }
    },
    inject:['obj','content'],
    data() {
     return {
      index: 1,
      pp:'',
      xdzj: {
        str:'我是兄弟2传过来的值'
      }
     }
    },
    mounted(){
        event.$on('child',(e)=>{
           this.pp = e
        }) 
    },

    methods:{
      fun1(){
        event.$emit('dd',this.xdzj)
      }
    }
   }
   </script>
   