The data data value in the vue component wants to get the data data value of the root instance, and the novice asks for guidance

:my-aaaaaaamy-aaamsgmsg:vm.aaaa
<div id="box">
    <my-aaa></my-aaa>
</div>

<script>
    var vm=new Vue({
        el:"-sharpbox",
        data:{
            aaaa:2
        },
        components:{
            "my-aaa":{
                data(){
                    return {
                        msg:vm.aaaa
                    }
                },
                methods:{
                    change(){
                        this.msg="changed";
                    }
                },
                template:"<h2 @click="change">2->{{msg}}</h2>"
            }
        }
    });

</script>

...
'my-aaa': {
  data() {
    return {
      msg: this.$root.aaaa
    }
  },
...

just use props directly. What is there to ask

?
Menu