This.$parent.attribute is a undefined problem in vue

this.$parent.attribute is a undefined problem in vue
vue2.9.6

<template>
<el-container>
  <h1>{{say}}</h1><br>
  <button @click="changeChild">changeChild</button>
  <child-component ref="child"></child-component>
</el-container>
</template>

<script>
export default {
  data () {
    return {
      say: "I"m parent."
    }
  },
  methods: {
    changeChild () {
    
      //
      this.$refs.child.say = new Date().getTime()
    }
  },
  components: {
    "child-component": {
      data () { return { say: "I"m child." } },
      template: "<div><h1>{{say}}</h1><button @click="changeParent">changeParent</button></div>",
      methods: {
        changeParent () {
        
          //undefinedsay
          console.info(this.$parent.say)
        }
      }
    }
  }
}
</script>

I call this.$parent.say in the subcomponent always undefined, I print out that there is no say attribute in $parent, which is very strange.
all the usages I see on the Internet are used in this way. Why is there nothing wrong with other people"s? Is there something I lack? Or is there something wrong with my usage?
solve, thank you!


Thank you! I found that this.$parent is not a conscious parent,. I just used two $parent.
this.$parent.$parent.say.


this.$nextTick(()=>{
  console.info(this.$parent.say)
})

is there an error in your console?
you use the full package of vue when you write that.
it's no problem for me to write this way. You can try it.
https://codepen.io/rushui/ful.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2c593-4e773.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2c593-4e773.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?