<template>
    <div id="parent">
     <div class="head_box">
      <el-button  type="primary" @click="parentEvent">我是父亲</el-button> 
      <Son @dd="dd" ref="hello1" :value="d" />
      <Son2 :value="f" ref="hello2" />
     </div>
    </div>
   </template>
   
   <script>
    import Son from '@/views/test/components/son'
   import Son2 from '@/views/test/components/son2'
   export default {
    name: 'parent',
    components: {
        Son,
        Son2
    },
    provide(){ 
       // content:'传给子组件的内容'
       return {
        content:this.index
       }
    },
    data() {
     return {
      index: '我是父组件传过来的值',
      d:1,
      f:2,
      msg:'我是父组件的值$parent'
     }
    },
    mounted(){

    },
    methods:{
     parentEvent() {
      console.log('通过$parent调我的方法');
      this.$refs.hello1.add();
      console.log(this.$refs.hello1.f);
     },
    }
   }
   </script>
   