Vue Custom component ref reported an error

when using custom components to use ref, an error is found.
when correct: click the button input box focus

 <div id="L4">
                <ref-component>
                </ref-component>
                
           </div>
           <script>
            Vue.component("ref-component",{
              template:`
                        <div>
                           <input ref="name" type="text">
                            <button  @click="focus">fouce</button>
                        </div>
                       `,
              methods:{
                focus:function(){
                this.$refs.name.focus()
                }
              }
            })
            new Vue({
              el:"-sharpL4"
            })

but if the button event is executed when the input box is written to a subcomponent, an error will be reported

     <div id="L4">
                <ref-component>
                </ref-component>
                
           </div>
           <script>
            Vue.component("ref-component",{
              template:`
                        <div>
                           <refs-component ref="name"></refs-component>
                            <button  @click="focus">fouce</button>
                        </div>
                       `,
              methods:{
                focus:function(){
                this.$refs.name.focus()
                }
              }
            })
            Vue.component("refs-component",{
              template:`<input type="text" />`
            })
            new Vue({
              el:"-sharpL4"
            })
           </script>

error report is

clipboard.png

how can I access the contents of this subcomponent?

Mar.12,2021

obviously refs-component this component does not have a focus method, and you do not have a reference on input

Vue.component('refs-component',{
  template:`<input ref='input' type="text" />`,
  methods: {
     focus(){
         this.$refs.input.focus();
     }
  }    
})

try this

Menu